Skip to content

Commit 3522c2a

Browse files
ricardonIngo Molnar
authored andcommitted
x86/cpufeature: Add User-Mode Instruction Prevention definitions
User-Mode Instruction Prevention is a security feature present in new Intel processors that, when set, prevents the execution of a subset of instructions if such instructions are executed in user mode (CPL > 0). Attempting to execute such instructions causes a general protection exception. The subset of instructions comprises: * SGDT - Store Global Descriptor Table * SIDT - Store Interrupt Descriptor Table * SLDT - Store Local Descriptor Table * SMSW - Store Machine Status Word * STR - Store Task Register This feature is also added to the list of disabled-features to allow a cleaner handling of build-time configuration. Signed-off-by: Ricardo Neri <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Chen Yucong <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Huang Rui <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi V. Shankar <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/1509935277-22138-7-git-send-email-ricardo.neri-calderon@linux.intel.com Signed-off-by: Ingo Molnar <[email protected]>
1 parent 9c6c799 commit 3522c2a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296

297297
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */
298298
#define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
299+
#define X86_FEATURE_UMIP (16*32+ 2) /* User Mode Instruction Protection */
299300
#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
300301
#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
301302
#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */

arch/x86/include/asm/disabled-features.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
# define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31))
1717
#endif
1818

19+
#ifdef CONFIG_X86_INTEL_UMIP
20+
# define DISABLE_UMIP 0
21+
#else
22+
# define DISABLE_UMIP (1<<(X86_FEATURE_UMIP & 31))
23+
#endif
24+
1925
#ifdef CONFIG_X86_64
2026
# define DISABLE_VME (1<<(X86_FEATURE_VME & 31))
2127
# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31))
@@ -63,7 +69,7 @@
6369
#define DISABLED_MASK13 0
6470
#define DISABLED_MASK14 0
6571
#define DISABLED_MASK15 0
66-
#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57)
72+
#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP)
6773
#define DISABLED_MASK17 0
6874
#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18)
6975

arch/x86/include/uapi/asm/processor-flags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
#define X86_CR4_OSFXSR _BITUL(X86_CR4_OSFXSR_BIT)
106106
#define X86_CR4_OSXMMEXCPT_BIT 10 /* enable unmasked SSE exceptions */
107107
#define X86_CR4_OSXMMEXCPT _BITUL(X86_CR4_OSXMMEXCPT_BIT)
108+
#define X86_CR4_UMIP_BIT 11 /* enable UMIP support */
109+
#define X86_CR4_UMIP _BITUL(X86_CR4_UMIP_BIT)
108110
#define X86_CR4_LA57_BIT 12 /* enable 5-level page tables */
109111
#define X86_CR4_LA57 _BITUL(X86_CR4_LA57_BIT)
110112
#define X86_CR4_VMXE_BIT 13 /* enable VMX virtualization */

0 commit comments

Comments
 (0)