[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3bc5132-98b4-485b-b400-5046350b7ccf@email.android.com>
Date: Mon, 20 Feb 2012 16:03:34 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>
CC: Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH][GIT PULL][v3.3] x86: Specify a size for the cmp in the NMI handler
You can use cmpl here... the segment is only a 16-bit number. Or use testb $3,...
Steven Rostedt <rostedt@...dmis.org> wrote:
>
>Ingo,
>
>Please pull the latest tip/x86/urgent tree, which can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
>tip/x86/urgent
>
>Head SHA1: 869d49dc575a9cf7041e535ea4911a511bbee764
>
>
>Steven Rostedt (1):
> x86: Specify a size for the cmp in the NMI handler
>
>----
> arch/x86/kernel/entry_64.S | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>---------------------------
>commit 869d49dc575a9cf7041e535ea4911a511bbee764
>Author: Steven Rostedt <srostedt@...hat.com>
>Date: Mon Feb 20 15:29:34 2012 -0500
>
> 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.
>
> The full 8 bytes is 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@...ux-foundation.org>
> Cc: H. Peter Anvin <hpa@...or.com>
> Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
>
>diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
>index debd851..666f2cb 100644
>--- a/arch/x86/kernel/entry_64.S
>+++ b/arch/x86/kernel/entry_64.S
>@@ -1535,14 +1535,14 @@ ENTRY(nmi)
> * If %cs was not the kernel segment, then the NMI triggered in user
> * space, which means it is definitely not nested.
> */
>- cmp $__KERNEL_CS, 16(%rsp)
>+ cmpq $__KERNEL_CS, 16(%rsp)
> jne first_nmi
>
> /*
> * Check the special variable on the stack to see if NMIs are
> * executing.
> */
>- cmp $1, -8(%rsp)
>+ cmpl $1, -8(%rsp)
> je nested_nmi
>
> /*
--
Sent from my mobile phone. Please excuse my brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists