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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 25 Aug 2021 23:35:02 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     linux-sgx@...r.kernel.org, Shuah Khan <shuah@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Kai Huang <kai.huang@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] x86/sgx: Add the missing ifdef for
 sgx_set_attribute()

On Thu, 2021-08-19 at 16:07 +0000, Sean Christopherson wrote:
> On Thu, Aug 19, 2021, Jarkko Sakkinen wrote:
> > Similarly as sgx_virt_*, decorate sgx_set_attribute() with ifdef, so that
> > calling it without appropraite config flags, will cause a compilation
> > error, and not a linking error.
> > 
> > Fixes: b3754e5d3da3 ("x86/sgx: Move provisioning device creation out of SGX driver")
> > Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
> > ---
> >  arch/x86/include/asm/sgx.h | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h
> > index 05f3e21f01a7..38c397ef35a8 100644
> > --- a/arch/x86/include/asm/sgx.h
> > +++ b/arch/x86/include/asm/sgx.h
> > @@ -365,6 +365,11 @@ struct sgx_sigstruct {
> >   * comment!
> >   */
> >  
> > +#if defined(CONFIG_X86_SGX) || defined(CONFIG_X86_SGX_KVM)
> 
> X86_SGX_KVM depends on X86_SGX
> 
> And rather than shuffle code, you can wrap all of the prototypes, which has the
> added bonus of "documenting" the aformentioned dependency, e.g.
> 
> diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h
> index 05f3e21f01a7..d5f3e617cc38 100644
> --- a/arch/x86/include/asm/sgx.h
> +++ b/arch/x86/include/asm/sgx.h
> @@ -365,6 +365,7 @@ struct sgx_sigstruct {
>   * comment!
>   */
> 
> +#ifdef CONFIG_X86_SGX
>  #ifdef CONFIG_X86_SGX_KVM
>  int sgx_virt_ecreate(struct sgx_pageinfo *pageinfo, void __user *secs,
>                      int *trapnr);
> @@ -374,5 +375,6 @@ int sgx_virt_einit(void __user *sigstruct, void __user *token,
> 
>  int sgx_set_attribute(unsigned long *allowed_attributes,
>                       unsigned int attribute_fd);
> +#endif /* CONFIG_X86_SGX */
> 
>  #endif /* _ASM_X86_SGX_H */

Right, makes sense.

A bit off from this patch set, but I'm wondering if there would be any benefit to
have a compile time flag for just the allocator part, since KVM depends only that.

I.e. you could compile a kernel with just KVM required bits for SGX.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ