aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/entry_64.S
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-02-20 15:29:34 -0500
committerSteven Rostedt <rostedt@goodmis.org>2012-02-20 19:45:26 -0500
commita38449ef596b345e13a8f9b7d5cd9fedb8fcf921 (patch)
tree67a44b0f4a694469babe2aa13786c206d382d228 /arch/x86/kernel/entry_64.S
parent45d5a1683c04be28abdf5c04c27b1417e0374486 (diff)
x86: Specify a size for the cmp in the NMI handler
Linus noticed that the cmp used to check if the code segment is __KERNEL_CS or not did not specify a size. Perhaps it does not matter as H. Peter Anvin noted that user space can not set the bottom two bits of the %cs register. But it's best not to let the assembly choose and change things between different versions of gas, but instead just pick the size. Four bytes are used to compare the saved code segment against __KERNEL_CS. Perhaps this might mess up Xen, but we can fix that when the time comes. Also I noticed that there was another non-specified cmp that checks the special stack variable if it is 1 or 0. This too probably doesn't matter what cmp is used, but this patch uses cmpl just to make it non ambiguous. Link: http://lkml.kernel.org/r/CA+55aFxfAn9MWRgS3O5k2tqN5ys1XrhSFVO5_9ZAoZKDVgNfGA@mail.gmail.com Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r--arch/x86/kernel/entry_64.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index debd851de6ff..1333d9851778 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1535,14 +1535,14 @@ ENTRY(nmi)
1535 * If %cs was not the kernel segment, then the NMI triggered in user 1535 * If %cs was not the kernel segment, then the NMI triggered in user
1536 * space, which means it is definitely not nested. 1536 * space, which means it is definitely not nested.
1537 */ 1537 */
1538 cmp $__KERNEL_CS, 16(%rsp) 1538 cmpl $__KERNEL_CS, 16(%rsp)
1539 jne first_nmi 1539 jne first_nmi
1540 1540
1541 /* 1541 /*
1542 * Check the special variable on the stack to see if NMIs are 1542 * Check the special variable on the stack to see if NMIs are
1543 * executing. 1543 * executing.
1544 */ 1544 */
1545 cmp $1, -8(%rsp) 1545 cmpl $1, -8(%rsp)
1546 je nested_nmi 1546 je nested_nmi
1547 1547
1548 /* 1548 /*