mbox series

[for_v25,0/3] x86/sgx: Fix feature control rebase

Message ID 20200201174940.20984-1-sean.j.christopherson@intel.com (mailing list archive)
Headers show
Series x86/sgx: Fix feature control rebase | expand

Message

Sean Christopherson Feb. 1, 2020, 5:49 p.m. UTC
Two patches to fix the Feature Control MSR bit definitions, which didn't
get correctly rebased.

Patch 03 reworks SGX handling of Feature Control to use the new feat_ctl.c
code, which was the entire point of that series.  Patch 03 is a drop-in
replacement for 4249f9b240b7 ("x86/cpu/intel: Detect SGX supprt").

*** DISCLAIMER ***
These patches are untested against your master, as your master doesn't boot
on my system.  The fully tested version is available at 
https://github.com/sean-jc/linux.git, branch sgx/for_jarkko_v25_rebased.
I'll dig into the boot issue next week.

Sean Christopherson (3):
  x86/msr: Fixup "Add Intel SGX hardware bits"
  x86/msr: Fixup "Intel SGX Launch Control hardware bits"
  x86/cpu: Configure SGX support when initializing feature control MSR

 arch/x86/include/asm/msr-index.h |  9 ++------
 arch/x86/kernel/cpu/feat_ctl.c   | 29 +++++++++++++++++++++++-
 arch/x86/kernel/cpu/intel.c      | 39 --------------------------------
 3 files changed, 30 insertions(+), 47 deletions(-)

Comments

Jarkko Sakkinen Feb. 1, 2020, 7:35 p.m. UTC | #1
On Sat, Feb 01, 2020 at 09:49:37AM -0800, Sean Christopherson wrote:
> Two patches to fix the Feature Control MSR bit definitions, which didn't
> get correctly rebased.
> 
> Patch 03 reworks SGX handling of Feature Control to use the new feat_ctl.c
> code, which was the entire point of that series.  Patch 03 is a drop-in
> replacement for 4249f9b240b7 ("x86/cpu/intel: Detect SGX supprt").
> 
> *** DISCLAIMER ***
> These patches are untested against your master, as your master doesn't boot
> on my system.  The fully tested version is available at 
> https://github.com/sean-jc/linux.git, branch sgx/for_jarkko_v25_rebased.
> I'll dig into the boot issue next week.

Possibly it was related  that I was temporarily on top of x86/tip?  It
is now again on top of Linus' tree. I created v25-rc2 tag that has
these updates:

tag v25-rc2
Tagger: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date:   Sat Feb 1 21:27:24 2020 +0200

x86/sgx: v25-rc2

* Fix a double-free issue when SGX_IOC_ENCLAVE_ADD_PAGES
  fails on executing ENCLS[EADD]. The rollback path executed
  radix_tree_delete() on the same address twice when this happened.
* Return -EINTR instead of -ERESTARTSYS in SGX_IOC_ENCLAVE_ADD_PAGES when
  a signal is pending.
* As requested by Borislav, move the CPUID 0x12 features to their own word
  in cpufeatures.
* Sean fixed a bug from sgx_reclaimer_write() where sgx_encl_put_backing()
  was called with an uninitialized pointer when sgx_encl_get_backing()
  fails.
* Migrated /dev/sgx/* to misc. This is future-proof as struct miscdevice
  has 'groups' for setting up sysfs attributes for the device.
* Use device_initcall instead of subsys_initcall so that misc_class is
  initialized before SGX is initialized.
* Return -EACCES in SGX_IOC_ENCLAVE_INIT when caller tries to select
  enclave attributes that we the kernel does not allow it to set instead
  of -EINVAL.
* Unless SGX public key MSRs are writable always deny the feature from
  Linux. Previously this was only denied from driver. How VMs should be
  supported is not really part of initial patch set, which makes this
  an obvious choice.
* Rewrote the documentation. Lessened the fine-grained micro architecture
  details as they can be looked up from Intel SDM in order to make the
  core ideas more approachable.
-----BEGIN PGP SIGNATURE-----

iJYEABYIAD4WIQRE6pSOnaBC00OEHEIaerohdGur0gUCXjXRMiAcamFya2tvLnNh
a2tpbmVuQGxpbnV4LmludGVsLmNvbQAKCRAaerohdGur0ihBAQC3VE2u6zyPYFLN
hCBFEF3LKqpNk26DjkO9M5tRZfUhSgEA/sF6AKHJRDqYUePW6N6Rtc3GOZY9DmbD
R+qOg0XcbAs=
=OtqV
-----END PGP SIGNATURE-----

If you fix any regression, use solely this tag as the baseline for
fixes. I worry about possible merge conflicts with the master.

/Jarkko
Jarkko Sakkinen Feb. 1, 2020, 10:18 p.m. UTC | #2
On Sat, Feb 01, 2020 at 09:35:59PM +0200, Jarkko Sakkinen wrote:
> On Sat, Feb 01, 2020 at 09:49:37AM -0800, Sean Christopherson wrote:
> > Two patches to fix the Feature Control MSR bit definitions, which didn't
> > get correctly rebased.
> > 
> > Patch 03 reworks SGX handling of Feature Control to use the new feat_ctl.c
> > code, which was the entire point of that series.  Patch 03 is a drop-in
> > replacement for 4249f9b240b7 ("x86/cpu/intel: Detect SGX supprt").
> > 
> > *** DISCLAIMER ***
> > These patches are untested against your master, as your master doesn't boot
> > on my system.  The fully tested version is available at 
> > https://github.com/sean-jc/linux.git, branch sgx/for_jarkko_v25_rebased.
> > I'll dig into the boot issue next week.
> 
> Possibly it was related  that I was temporarily on top of x86/tip?  It
> is now again on top of Linus' tree. I created v25-rc2 tag that has
> these updates:
> 
> tag v25-rc2
> Tagger: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> Date:   Sat Feb 1 21:27:24 2020 +0200
> 
> x86/sgx: v25-rc2
> 
> * Fix a double-free issue when SGX_IOC_ENCLAVE_ADD_PAGES
>   fails on executing ENCLS[EADD]. The rollback path executed
>   radix_tree_delete() on the same address twice when this happened.
> * Return -EINTR instead of -ERESTARTSYS in SGX_IOC_ENCLAVE_ADD_PAGES when
>   a signal is pending.
> * As requested by Borislav, move the CPUID 0x12 features to their own word
>   in cpufeatures.
> * Sean fixed a bug from sgx_reclaimer_write() where sgx_encl_put_backing()
>   was called with an uninitialized pointer when sgx_encl_get_backing()
>   fails.
> * Migrated /dev/sgx/* to misc. This is future-proof as struct miscdevice
>   has 'groups' for setting up sysfs attributes for the device.
> * Use device_initcall instead of subsys_initcall so that misc_class is
>   initialized before SGX is initialized.
> * Return -EACCES in SGX_IOC_ENCLAVE_INIT when caller tries to select
>   enclave attributes that we the kernel does not allow it to set instead
>   of -EINVAL.
> * Unless SGX public key MSRs are writable always deny the feature from
>   Linux. Previously this was only denied from driver. How VMs should be
>   supported is not really part of initial patch set, which makes this
>   an obvious choice.
> * Rewrote the documentation. Lessened the fine-grained micro architecture
>   details as they can be looked up from Intel SDM in order to make the
>   core ideas more approachable.
> -----BEGIN PGP SIGNATURE-----
> 
> iJYEABYIAD4WIQRE6pSOnaBC00OEHEIaerohdGur0gUCXjXRMiAcamFya2tvLnNh
> a2tpbmVuQGxpbnV4LmludGVsLmNvbQAKCRAaerohdGur0ihBAQC3VE2u6zyPYFLN
> hCBFEF3LKqpNk26DjkO9M5tRZfUhSgEA/sF6AKHJRDqYUePW6N6Rtc3GOZY9DmbD
> R+qOg0XcbAs=
> =OtqV
> -----END PGP SIGNATURE-----
> 
> If you fix any regression, use solely this tag as the baseline for
> fixes. I worry about possible merge conflicts with the master.
> 
> /Jarkko

As far as I'm concerned master has now everything for v25, so I removed
the tag. Just test against master.

/Jarkko
Sean Christopherson Feb. 3, 2020, 8:04 p.m. UTC | #3
On Sun, Feb 02, 2020 at 12:18:04AM +0200, Jarkko Sakkinen wrote:
> On Sat, Feb 01, 2020 at 09:35:59PM +0200, Jarkko Sakkinen wrote:
> > If you fix any regression, use solely this tag as the baseline for
> > fixes. I worry about possible merge conflicts with the master.
> > 
> > /Jarkko
> 
> As far as I'm concerned master has now everything for v25, so I removed
> the tag. Just test against master.

Sent a fix for the boot issue.

Can you also rebase to Linus' latest tree?  Or any tree that containts
commit 8df5bb4a03b0 ("char: hpet: Fix out-of-bounds read bug").  Spent the
morning bisecting another boot crash due to the hpet bug...
Jarkko Sakkinen Feb. 4, 2020, 5:26 a.m. UTC | #4
On Mon, Feb 03, 2020 at 12:04:41PM -0800, Sean Christopherson wrote:
> On Sun, Feb 02, 2020 at 12:18:04AM +0200, Jarkko Sakkinen wrote:
> > On Sat, Feb 01, 2020 at 09:35:59PM +0200, Jarkko Sakkinen wrote:
> > > If you fix any regression, use solely this tag as the baseline for
> > > fixes. I worry about possible merge conflicts with the master.
> > > 
> > > /Jarkko
> > 
> > As far as I'm concerned master has now everything for v25, so I removed
> > the tag. Just test against master.
> 
> Sent a fix for the boot issue.
> 
> Can you also rebase to Linus' latest tree?  Or any tree that containts
> commit 8df5bb4a03b0 ("char: hpet: Fix out-of-bounds read bug").  Spent the
> morning bisecting another boot crash due to the hpet bug...

OK, I'll send the patch set today.

/Jarkko