Skip to content

Commit 6b51311

Browse files
bp3tk0vIngo Molnar
authored and
Ingo Molnar
committed
x86/asm/entry/64: Use a define for an invalid segment selector
... instead of a naked number, for better readability. Signed-off-by: Borislav Petkov <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Will Drewry <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 7c74d5b commit 6b51311

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

arch/x86/include/asm/segment.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
/* ... GDT has it cleared */
4040
#define SEGMENT_GDT 0x0
4141

42+
#define GDT_ENTRY_INVALID_SEG 0
43+
4244
#ifdef CONFIG_X86_32
4345
/*
4446
* The layout of the per-CPU GDT under Linux:

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ void syscall_init(void)
11841184
wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
11851185
#else
11861186
wrmsrl(MSR_CSTAR, ignore_sysret);
1187-
wrmsrl_safe(MSR_IA32_SYSENTER_CS, 0ULL);
1187+
wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
11881188
wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
11891189
wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL);
11901190
#endif

0 commit comments

Comments
 (0)