diff options
author | Andi Kleen <ak@suse.de> | 2006-09-26 04:52:41 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:41 -0400 |
commit | 658fdbef66e5e9be79b457edc2cbbb3add840aa9 (patch) | |
tree | 931fa9bac154671ab96762fee73b3641b1191bb8 /include/asm-x86_64/system.h | |
parent | adf1423698f00d00b267f7dca8231340ce7d65ef (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 'include/asm-x86_64/system.h')
-rw-r--r-- | include/asm-x86_64/system.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 6bf170bceae1..bd376bc8c4ab 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -14,12 +14,13 @@ | |||
14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | 14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" |
15 | 15 | ||
16 | /* frame pointer must be last for get_wchan */ | 16 | /* frame pointer must be last for get_wchan */ |
17 | #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" | 17 | #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" |
18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" | 18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" |
19 | 19 | ||
20 | #define __EXTRA_CLOBBER \ | 20 | #define __EXTRA_CLOBBER \ |
21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" | 21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" |
22 | 22 | ||
23 | /* Save restore flags to clear handle leaking NT */ | ||
23 | #define switch_to(prev,next,last) \ | 24 | #define switch_to(prev,next,last) \ |
24 | asm volatile(SAVE_CONTEXT \ | 25 | asm volatile(SAVE_CONTEXT \ |
25 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 26 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |