From: Borislav Petkov <bp@alien8.de>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Alexei Starovoitov <ast@plumgrid.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Kees Cook <keescook@chromium.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Will Drewry <wad@chromium.org>
Subject: [PATCH] x86/asm/entry/64: Use a define for an invalid segment
Date: Fri, 3 Apr 2015 14:25:28 +0200 [thread overview]
Message-ID: <20150403122528.GC3418@pd.tnic> (raw)
In-Reply-To: <20150403120516.GB3418@pd.tnic>
On Fri, Apr 03, 2015 at 02:05:17PM +0200, Borislav Petkov wrote:
> Let me do a patch.
---
From: Borislav Petkov <bp@suse.de>
Date: Fri, 3 Apr 2015 14:22:00 +0200
Subject: [PATCH] x86/asm/entry/64: Use a define for an invalid segment
selector
... instead of a naked number, for better readability.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/include/asm/segment.h | 2 ++
arch/x86/kernel/cpu/common.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index d394899e055c..5a9856eb12ba 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -39,6 +39,8 @@
/* ... GDT has it cleared */
#define SEGMENT_GDT 0x0
+#define GDT_ENTRY_INVALID_SEG 0
+
#ifdef CONFIG_X86_32
/*
* The layout of the per-CPU GDT under Linux:
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 2c249b57e4b5..a62cf04dac8a 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1223,7 +1223,7 @@ void syscall_init(void)
wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
#else
wrmsrl(MSR_CSTAR, ignore_sysret);
- wrmsrl_safe(MSR_IA32_SYSENTER_CS, 0ULL);
+ wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL);
wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL);
#endif
--
2.3.3
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-04-03 12:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 9:42 [PATCH] x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value Borislav Petkov
2015-04-03 11:20 ` Borislav Petkov
2015-04-03 11:52 ` Denys Vlasenko
2015-04-03 12:05 ` Borislav Petkov
2015-04-03 12:25 ` Borislav Petkov [this message]
2015-04-03 14:07 ` [tip:x86/asm] " tip-bot for Borislav Petkov
2015-04-03 14:07 ` [tip:x86/asm] x86/asm/entry/64: Use a define for an invalid segment selector tip-bot for Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150403122528.GC3418@pd.tnic \
--to=bp@alien8.de \
--cc=ast@plumgrid.com \
--cc=dvlasenk@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=wad@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.