Bug 106051

Summary: efivarsfs not available on Surface 3 (Cherrytrail)
Product: EFI Reporter: Bastien Nocera (bugzilla)
Component: ServicesAssignee: EFI Virtual User (efi)
Status: RESOLVED CODE_FIX    
Severity: normal CC: bp, matt, stephenjust
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.3-rc5 Subsystem:
Regression: No Bisected commit-id:
Attachments: efi-debug.txt
efi-debug-old-map.txt
test fix

Description Bastien Nocera 2015-10-16 10:49:50 UTC
The efivarsfs filesystem isn't available on the Surface 3 with the 4.3-rc5 kernel and Secure Boot disabled, as this call fails on the machine:
static __init int efivarfs_init(void)
{
        if (!efi_enabled(EFI_RUNTIME_SERVICES)) {

The system is booted through EFI, as this printout shows at boot time:
Oct 15 17:07:37 localhost kernel: efi: EFI v2.40 by American Megatrends
 Oct 15 17:07:37 localhost kernel: efi:  ESRT=0xbb7cac98  ACPI=0xbad5d000  ACPI 2.0=0xbad5d000  SMBIOS=0xbb5fbd18 
 Oct 15 17:07:37 localhost kernel: esrt: Reserving ESRT space from 0x00000000bb7cac98 to 0x00000000bb7cad20.

Checking for the available EFI features yields:
Oct 15 22:54:52 localhost kernel: boot: 1 system tables: 1, config tables 1, runtime services 0, memmap 1, 64-bit 1
Comment 1 Matt Fleming 2015-10-16 11:26:02 UTC
Could you upload the output of dmesg with the efi=debug kernel command line parameter enabled?
Comment 2 Bastien Nocera 2015-10-16 12:05:28 UTC
Created attachment 190331 [details]
efi-debug.txt
Comment 3 Matt Fleming 2015-10-16 12:14:22 UTC
Nice, your dmesg contains some useful info, e.g.

Oct 16 09:59:38 localhost kernel: Error mapping PA 0xffc00000 -> VA 0xffc00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xffc00000 -> VA 0xfffffffeffc00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfee00000 -> VA 0xfee00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfee00000 -> VA 0xfffffffeffa00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed80000 -> VA 0xfed80000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed80000 -> VA 0xfffffffeff980000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed1c000 -> VA 0xfed1c000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed1c000 -> VA 0xfffffffeff91c000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed08000 -> VA 0xfed08000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed08000 -> VA 0xfffffffeff908000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed06000 -> VA 0xfed06000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed06000 -> VA 0xfffffffeff906000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed03000 -> VA 0xfed03000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed03000 -> VA 0xfffffffeff903000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed01000 -> VA 0xfed01000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfed01000 -> VA 0xfffffffeff901000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfec00000 -> VA 0xfec00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfec00000 -> VA 0xfffffffeff800000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfea00000 -> VA 0xfea00000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xfea00000 -> VA 0xfffffffeff600000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xe0000000 -> VA 0xe0000000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xe0000000 -> VA 0xfffffffefb600000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0x13fd83000 -> VA 0x13fd83000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0x13fd83000 -> VA 0xfffffffefb383000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0x1384b4000 -> VA 0x1384b4000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0x1384b4000 -> VA 0xfffffffef96b4000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbad2000 -> VA 0xbbad2000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbad2000 -> VA 0xfffffffef90d2000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbad1000 -> VA 0xbbad1000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbad1000 -> VA 0xfffffffef90d1000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbacd000 -> VA 0xbbacd000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbbacd000 -> VA 0xfffffffef90cd000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbb7cd000 -> VA 0xbb7cd000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbb7cd000 -> VA 0xfffffffef8dcd000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbb3c0000 -> VA 0xbb3c0000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xbb3c0000 -> VA 0xfffffffef89c0000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xba860000 -> VA 0xba860000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xba860000 -> VA 0xfffffffef8860000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xba000000 -> VA 0xba000000!
Oct 16 09:59:38 localhost kernel: Error mapping PA 0xba000000 -> VA 0xfffffffef8800000!
Oct 16 09:59:38 localhost kernel: Error ident-mapping new memmap (0x13f4e8000)!

The last error message in particular is important because it clears the EFI_RUNTIME_SERVICES bit.

Now the *reason* the mappings fail is because your CPU doesn't support the Non-Executable bit (NX) which is required by the mapping code,

Oct 16 09:59:38 localhost kernel: Notice: NX (Execute Disable) protection missing in CPU!

Could you try booting with efi=old_map,debug and see if things work?
Comment 4 Matt Fleming 2015-10-16 12:15:11 UTC
Also, please check to see whether there's a BIOS option in the setup menu to enable support for the NX bit.
Comment 5 Bastien Nocera 2015-10-16 12:25:46 UTC
(In reply to Matt Fleming from comment #4)
> Also, please check to see whether there's a BIOS option in the setup menu to
> enable support for the NX bit.

This is the list of CPU features that the x7-Z8700 supports, in Windows (gathered through WinAudit):
ACPI, AESNI, APIC, CLFSH, CMOV, CMPXCHG16B, CX8, DE, DS, DS-CPL, DTES64, EDB, EIST, FPU, FXFR, HTT, IA64, LAHF, MCA, MCE, MMX, MONITOR, MOVBE, MSR, MTRR, PAE, PAT, PBE, PCLMULQDQ, PDCM, PGE, POPCNT, PSE, PSE-36, RDRAND, RDTSCP, SEP, SS, SSE, SSE2, SSE3, SSE4.1, SSE4.2, SSSE3, TM, TM2, TSC, TSC-Deadline, VME, VMX, xTPR

No NX. I wonder if it's only enabled when Secure Boot is enabled.
Comment 6 Bastien Nocera 2015-10-16 12:30:37 UTC
Created attachment 190341 [details]
efi-debug-old-map.txt

$ grep efi /proc/filesystems 
nodev	efivarfs

yes!
Comment 7 Borislav Petkov 2015-10-16 12:39:52 UTC
(In reply to Bastien Nocera from comment #5)
> (In reply to Matt Fleming from comment #4)
> > Also, please check to see whether there's a BIOS option in the setup menu
> to
> > enable support for the NX bit.
> 
> This is the list of CPU features that the x7-Z8700 supports, in Windows
> (gathered through WinAudit):

You need to enter the BIOS/UEFI and check whether there's an option
there to disable/enable Non Execute...
Comment 8 Bastien Nocera 2015-10-16 12:47:49 UTC
(In reply to Borislav Petkov from comment #7)
> (In reply to Bastien Nocera from comment #5)
> > (In reply to Matt Fleming from comment #4)
> > > Also, please check to see whether there's a BIOS option in the setup menu
> to
> > > enable support for the NX bit.
> > 
> > This is the list of CPU features that the x7-Z8700 supports, in Windows
> > (gathered through WinAudit):
> 
> You need to enter the BIOS/UEFI and check whether there's an option
> there to disable/enable Non Execute...

I did, and there isn't. I can enable/disable the TPM (it's enabled), Secure Boot (it's disabled), change the boot order, and that's pretty much it.

You can see the full list of items that can be changed here:
http://www.microsoft.com/surface/en-us/support/warranty-service-and-recovery/how-to-use-the-bios-uefi

Look for "Surface 3" near the bottom of the page.
Comment 9 Borislav Petkov 2015-10-16 13:13:44 UTC
Hmm, so can you boot linux with "efi=old_map" and do as root:

rdmsr -a 0x1a0

and also

cpuid -r

and paste outputs here?

cpuid is reportedly a package from here:
http://www.etallen.com/cpuid.html, if the distro doesn't have it.

The rdmsr cmd gives on my IVB box:

rdmsr -a 0x1a0
850089
850089
850089
850089

and more specifically, bit 34 is cleared. On your machine it will
probably be set.

If you're brave you can try to clear it. I say brave because if NX
is not supported, it should generate a #GP but wrmsr uses the _safe
routines so you should get an error that it wasn't able to write.

You know it is supported if you look at the cpuid output:

...
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000001 edx=0x28100800

bit 20 in edx is set. If it is not set, then it means this box doesn't
support NX bit. If it is, you could try this:

wrmsr -a 0x1a0 $(( <previous value rdmsr read above> & ~(1 << 34) ))

as root.

HTH.
Comment 10 Bastien Nocera 2015-10-18 19:17:01 UTC
# rdmsr -a 0x1a0
400850089
850089
850089
850089

# cpuid -r
CPU 0:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x00100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000000
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28000800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
CPU 1:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x02100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000002
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
CPU 2:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x04100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000004
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
CPU 3:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x06100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000006
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006

I'll pass on the wrmsr call for now, unless there's absolutely no way around it.
Comment 11 Borislav Petkov 2015-10-18 20:18:10 UTC
(In reply to Bastien Nocera from comment #10)
> # rdmsr -a 0x1a0
> 400850089
> 850089
> 850089
> 850089

Lovely b0rked BIOS. Only CPU0 has eXecute Disable bit set, i.e. bit 34.
The other cores don't. WTF?!

FWIW, we've had this already with a Dell machine. And I had a patch to
try to workaround this by clearing that but on the 64-bit entry path but
AFAIR, that didn't work because the #GP condition hit, i.e. #GP because
the corresponding CPUID bit 20 here:

>    0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101
>    edx=0x28000800

is set to 0.

I need to think about this more...

Hmm.

> I'll pass on the wrmsr call for now, unless there's absolutely no way
> around it.

Yeah, btw, it was a bit wrong because the MSR value is implicitly in
hex. It should've been:

wrmsr -a 0x1a0 $(( 0x<previous value rdmsr read above> & ~(1 << 34) ))

(see the preceding "0x").

But regardless, I'm going to venture a guess that even if you tried it,
it won't work.

Let me ping some Intel people...
Comment 12 Borislav Petkov 2015-11-04 19:09:09 UTC
Hmm, so I might have a fix. I'm trying to test it here by toggling XD in
the Dell BIOS but XD remains cleared, i.e., as it should be. Anyway, you
can try the patch below against 4.3. Please catch the same output as in
comment #10 if the box still boots.

:-)

Thanks.
Comment 13 Borislav Petkov 2015-11-04 19:10:49 UTC
Created attachment 192101 [details]
test fix
Comment 14 Bastien Nocera 2015-11-05 15:22:47 UTC
I tried it against the current 4.4 (my kernels follow Fedora's rawhide kernels), and 1) it boots 2) it can mount efivarsfs!

# rdmsr -a 0x1a0
850089
850089
850089
850089

# cpuid -r
CPU 0:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x00100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000000
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000000
CPU 1:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x02100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000002
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000002
CPU 2:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x04100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000004
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000004
CPU 3:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000406c3 ebx=0x06100800 ecx=0x43d8e3bf edx=0xbfebfbff
   0x00000002 0x00: eax=0x61b4a001 ebx=0x0000ffc2 ecx=0x00000000 edx=0x00000000
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x1c000121 ebx=0x0140003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x01: eax=0x1c000122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000001
   0x00000004 0x02: eax=0x1c00c143 ebx=0x03c0003f ecx=0x000003ff edx=0x00000001
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x33000020
   0x00000006 0x00: eax=0x00000007 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00002282 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07280203 ebx=0x00000000 ecx=0x00000000 edx=0x00000503
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006
   0x0000000b 0x01: eax=0x00000004 ebx=0x00000004 ecx=0x00000201 edx=0x00000006
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000101 edx=0x28100800
   0x80000002 0x00: eax=0x20202020 ebx=0x6e492020 ecx=0x286c6574 edx=0x41202952
   0x80000003 0x00: eax=0x286d6f74 ebx=0x20294d54 ecx=0x5a2d3778 edx=0x30303738
   0x80000004 0x00: eax=0x50432020 ebx=0x20402055 ecx=0x30362e31 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x04008040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x00003024 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000001 ecx=0x00000100 edx=0x00000006
Comment 15 Borislav Petkov 2015-11-05 15:48:45 UTC
Good, I'll add your Tested-by and queue it, thanks for testing.