aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:41 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:41 -0400
commit658fdbef66e5e9be79b457edc2cbbb3add840aa9 (patch)
tree931fa9bac154671ab96762fee73b3641b1191bb8 /arch/x86_64
parentadf1423698f00d00b267f7dca8231340ce7d65ef (diff)
[PATCH] Don't leak NT bit into next task
SYSENTER can cause a NT to be set which might cause crashes on the IRET in the next task. Following similar i386 patch from Linus. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/entry.S4
-rw-r--r--arch/x86_64/kernel/setup64.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 4cbc65290ae7..2802524104f3 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -155,6 +155,10 @@
155/* rdi: prev */ 155/* rdi: prev */
156ENTRY(ret_from_fork) 156ENTRY(ret_from_fork)
157 CFI_DEFAULT_STACK 157 CFI_DEFAULT_STACK
158 push kernel_eflags(%rip)
159 CFI_ADJUST_CFA_OFFSET 4
160 popf # reset kernel eflags
161 CFI_ADJUST_CFA_OFFSET -4
158 call schedule_tail 162 call schedule_tail
159 GET_THREAD_INFO(%rcx) 163 GET_THREAD_INFO(%rcx)
160 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx) 164 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx)
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 9332d2361e08..8c4b80fe71a1 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -180,6 +180,8 @@ void __cpuinit check_efer(void)
180 } 180 }
181} 181}
182 182
183unsigned long kernel_eflags;
184
183/* 185/*
184 * cpu_init() initializes state that is per-CPU. Some data is already 186 * cpu_init() initializes state that is per-CPU. Some data is already
185 * initialized (naturally) in the bootstrap process, such as the GDT 187 * initialized (naturally) in the bootstrap process, such as the GDT
@@ -281,4 +283,6 @@ void __cpuinit cpu_init (void)
281 set_debugreg(0UL, 7); 283 set_debugreg(0UL, 7);
282 284
283 fpu_init(); 285 fpu_init();
286
287 raw_local_save_flags(kernel_eflags);
284} 288}