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] [day] [month] [year] [list]
Date:   Mon, 12 Sep 2022 20:54:20 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "Chatre, Reinette" <reinette.chatre@...el.com>,
        "Hansen, Dave" <dave.hansen@...el.com>,
        "jarkko@...nel.org" <jarkko@...nel.org>
CC:     "linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH] x86/intel: Clear SGX bit if both SGX driver and KVM SGX
 are not enabled

On Mon, 2022-09-12 at 07:34 -0700, Dave Hansen wrote:
> On 9/12/22 07:31, Reinette Chatre wrote:
> > 
> > On 9/12/2022 3:47 AM, Jarkko Sakkinen wrote:
> > > On Fri, Sep 09, 2022 at 08:08:53PM +1200, Kai Huang wrote:
> > > > Currently on platform which has SGX enabled, if CONFIG_X86_SGX is not
> > > > enabled, the X86_FEATURE_SGX is not cleared, resulting in /proc/cpuinfo
> > > > shows "sgx" feature.  This is not desired.
> > > > 
> > > > Clear SGX feature bit if both SGX driver and KVM SGX are not enabled in
> > > > init_ia32_feat_ctl().
> > > > 
> > > > Signed-off-by: Kai Huang <kai.huang@...el.com>
> > > Is it a pattern that flags are cleared when they are disabled by the
> > > kernel? I don't know the answer for this.
> 
> There's no good pattern.
> 
> But, one guideline is that the X86_FEATURE_*'s are for the *kernel*.
> They are *not* for userspace.  The fact that the features are exposed to
> userspace in cpuinfo is unfortunate, but it doesn't change our guideline.
> 
> So, if this patch is done only for the benefit of userspace, I don't
> think we should apply it.

It's not done for the userspace.  AFAICT no one is complaining about this.  I
just happened to see this and thought it's a right thing to do.

Also, in my other reply to this thread I put one reason that I think it's
reasonable:

"
But for SGX even the current upstream code clears SGX feature in some
conditions, for example, when SGX_LC is disabled by BIOS (in which case only KVM
SGX can be supported) and KVM SGX is also disabled, i.e. due to
CONFIG_X86_SGX_KVM isn't set:

    if (!(msr & FEAT_CTL_SGX_LC_ENABLED) && enable_sgx_driver) {
            if (!enable_sgx_kvm) {
                    pr_err_once("SGX Launch Control is locked. Disable SGX.\n");
                    clear_cpu_cap(c, X86_FEATURE_SGX);
	    else {
	            ...
	    }
    }

So I think it makes sense to clear SGX if both SGX driver and KVM SGX are not
enabled by the kernel.
"

-- 
Thanks,
-Kai


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ