lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 25 Mar 2023 00:04:28 +0000
From:   "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
To:     "Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
        Borislav Petkov <bp@...en8.de>
CC:     "hpa@...or.com" <hpa@...or.com>, KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        Dexuan Cui <decui@...rosoft.com>,
        "luto@...nel.org" <luto@...nel.org>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "lpieralisi@...nel.org" <lpieralisi@...nel.org>,
        "robh@...nel.org" <robh@...nel.org>, "kw@...ux.com" <kw@...ux.com>,
        "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
        "arnd@...db.de" <arnd@...db.de>, "hch@....de" <hch@....de>,
        "m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
        "robin.murphy@....com" <robin.murphy@....com>,
        "thomas.lendacky@....com" <thomas.lendacky@....com>,
        "brijesh.singh@....com" <brijesh.singh@....com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "sathyanarayanan.kuppuswamy@...ux.intel.com" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "isaku.yamahata@...el.com" <isaku.yamahata@...el.com>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "jane.chu@...cle.com" <jane.chu@...cle.com>,
        "seanjc@...gle.com" <seanjc@...gle.com>,
        "tony.luck@...el.com" <tony.luck@...el.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>
Subject: RE: [PATCH v6 06/13] x86/hyperv: Change vTOM handling to use standard
 coco mechanisms

From: Michael Kelley (LINUX) <mikelley@...rosoft.com>
> 
> From: Borislav Petkov <bp@...en8.de> Sent: Friday, March 24, 2023 8:49 AM
> >
> > On Thu, Mar 23, 2023 at 02:43:06PM +0100, Borislav Petkov wrote:
> > > Ok, lemme queue 1-2,4-6 as previously mentioned.
> >
> > With first six applied:
> >
> > arch/x86/coco/core.c:123:7: error: use of undeclared identifier 'sev_status'
> >                 if (sev_status & MSR_AMD64_SNP_VTOM)
> >                     ^
> > arch/x86/coco/core.c:139:7: error: use of undeclared identifier 'sev_status'
> >                 if (sev_status & MSR_AMD64_SNP_VTOM)
> >                     ^
> > 2 errors generated.
> > make[3]: *** [scripts/Makefile.build:252: arch/x86/coco/core.o] Error 1
> > make[2]: *** [scripts/Makefile.build:494: arch/x86/coco] Error 2
> > make[1]: *** [scripts/Makefile.build:494: arch/x86] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> > make: *** [Makefile:2025: .] Error 2
> >
> > compiler is:
> >
> > Debian clang version 14.0.6-2
> > Target: x86_64-pc-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> >
> > .config is attached.
> >
> 
> OK, I see what went wrong.  I had tested with CONFIG_AMD_MEM_ENCRYPT=n
> and didn't see any compile problems.  It turns out in my test, arch/x86/coco/core.c
> wasn't built at all because I did not also have TDX configured, so I didn't see
> any errors.  But with CONFIG_INTEL_TDX_GUEST=y, coco/core.c gets built, and
> the error with undefined sev_status pops out.
> 
> The straightforward fix is somewhat ugly.  That's to put #ifdef
> CONFIG_AMD_MEM_ENCRYPT around the entire CC_VENDOR_AMD
> case in cc_mkenc() and in cc_mkdec().  Or put it just around the test of
> sev_status.
> 
> Perhaps a cleaner way would be to have a "vendor_subtype" variable
> declared in arch/x86/coco/core.c and tested instead of sev_status.
> That subtype variable would be set from hv_vtom_init(), maybe via
> a separate accessor function.  But didn't I recently see a patch that
> makes the existing "vendor" variable no longer static?   In that case
> just setting vendor_subtype without the accessor function may be
> OK.
> 
> What's your preference Boris?  I can spin a v7 of the patch series
> that fixes this, and that squashes the last two patches of the series
> per Lorenz Pieralisi's comments.
> 

Actually, a pretty clean approach is to #define sev_status 0ULL in
the #else /* !CONFIG_AMD_MEM_ENCRYPT */ half of
arch/x86/include/asm/mem_encrypt.h.   That's where the existing
extern statement is, and  sme_me_mask is already handled that way.

I'll respin the patch set with that approach.

Michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ