diff options
author | Andi Kleen <ak@suse.de> | 2007-06-22 20:29:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-22 21:41:19 -0400 |
commit | 75154f402ef18e459ff97ddece25656b6c2b329c (patch) | |
tree | 6757b77ee2c712c4b64f334ff8c5b1a41a64083b /arch/x86_64/kernel | |
parent | e2f1f19272f8de0374ad297b9806f8b6509e0013 (diff) |
x86_64: Ignore compat mode SYSCALL when IA32_EMULATION is not defined
Previously a program could switch to a compat mode segment and then
execute SYSCALL and it would jump to an uninitialized MSR and crash
the kernel.
Instead supply a dummy target for this case.
Pointed out by Jan Beulich
Cc: jbeulich@novell.com
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r-- | arch/x86_64/kernel/entry.S | 7 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup64.c | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index fa984b53e7e6..a67f87bf4015 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -1163,3 +1163,10 @@ ENTRY(call_softirq) | |||
1163 | ret | 1163 | ret |
1164 | CFI_ENDPROC | 1164 | CFI_ENDPROC |
1165 | ENDPROC(call_softirq) | 1165 | ENDPROC(call_softirq) |
1166 | |||
1167 | KPROBE_ENTRY(ignore_sysret) | ||
1168 | CFI_STARTPROC | ||
1169 | mov $-ENOSYS,%eax | ||
1170 | sysret | ||
1171 | CFI_ENDPROC | ||
1172 | ENDPROC(ignore_sysret) | ||
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 64379a80d763..1200aaac403e 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -150,6 +150,8 @@ void pda_init(int cpu) | |||
150 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ] | 150 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ] |
151 | __attribute__((section(".bss.page_aligned"))); | 151 | __attribute__((section(".bss.page_aligned"))); |
152 | 152 | ||
153 | extern asmlinkage void ignore_sysret(void); | ||
154 | |||
153 | /* May not be marked __init: used by software suspend */ | 155 | /* May not be marked __init: used by software suspend */ |
154 | void syscall_init(void) | 156 | void syscall_init(void) |
155 | { | 157 | { |
@@ -160,6 +162,7 @@ void syscall_init(void) | |||
160 | */ | 162 | */ |
161 | wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); | 163 | wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); |
162 | wrmsrl(MSR_LSTAR, system_call); | 164 | wrmsrl(MSR_LSTAR, system_call); |
165 | wrmsrl(MSR_CSTAR, ignore_sysret); | ||
163 | 166 | ||
164 | #ifdef CONFIG_IA32_EMULATION | 167 | #ifdef CONFIG_IA32_EMULATION |
165 | syscall32_cpu_init (); | 168 | syscall32_cpu_init (); |