From: Ian Campbell <ian.campbell@citrix.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Christian Kujau <lists@nerdbynature.de>,
Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
"H. Peter Anvin" <hpa@zytor.com>, Brian Gerst <brgerst@gmail.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH] xen: 64 bit kernel RPL should be 0.
Date: Wed, 13 Jan 2010 10:16:08 +0000 [thread overview]
Message-ID: <1263377768-19600-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1263377706.16526.12062.camel@zakaz.uk.xensource.com>
Under Xen 64 bit guests actually run their kernel in ring 3, however the
hypervisor takes care of squashing descriptor the RPLs transparently (in
order to allow them to continue to differentiate between user and kernel
space CS using the RPL). Therefore the Xen paravirt backend should use
RPL==0 instead of 1 (or 3). Using RPL==1 causes generic arch code to
take incorrect code paths because it uses "testl $3, <CS>, je foo" type
tests for a userspace CS and this considers 1==userspace.
This issue was previously masked because get_kernel_rpl() was omitted
when setting CS in kernel_thread(). This was fixed when kernel_thread()
was unified with 32 bit in f443ff4201dd25cd4dec183f9919ecba90c8edc2.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
arch/x86/xen/enlighten.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2b26dd5..36daccb 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1151,9 +1151,13 @@ asmlinkage void __init xen_start_kernel(void)
/* keep using Xen gdt for now; no urgent need to change it */
+#ifdef CONFIG_X86_32
pv_info.kernel_rpl = 1;
if (xen_feature(XENFEAT_supervisor_mode_kernel))
pv_info.kernel_rpl = 0;
+#else
+ pv_info.kernel_rpl = 0;
+#endif
/* set the limit of our address space */
xen_reserve_top();
--
1.5.6.5
next prev parent reply other threads:[~2010-01-13 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 10:15 [GIT PULL] update paravirt after f443ff42 "x86: Sync 32/64-bit kernel_thread" and related Ian Campbell
2010-01-13 10:16 ` [PATCH] x86: kernel_thread -- initialize SS to a known state Ian Campbell
2010-01-13 16:39 ` [tip:x86/urgent] x86: kernel_thread() " tip-bot for Cyrill Gorcunov
2010-01-13 10:16 ` Ian Campbell [this message]
2010-01-13 16:39 ` [tip:x86/urgent] x86: xen: 64-bit kernel RPL should be 0 tip-bot for Ian Campbell
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=1263377768-19600-2-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Jeremy.Fitzhardinge@citrix.com \
--cc=brgerst@gmail.com \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome