lkml.org 
[lkml]   [2010]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.6.33-rc2: Xen/Guest switching to user mode with no user page tables
On Thu, Jan 07, 2010 at 11:30:46AM -0800, Christian Kujau wrote:
> On Thu, 7 Jan 2010 at 11:19, H. Peter Anvin wrote:
> > The big difference between the code before and after this commit is that
> > before, kernel_thread() would initialize the pt_regs structure with
> > whatever state happened to be passed into it by the caller, whereas
> > afterwards it is initialized to zero.
>
> To be honest, bisection was kinda hazy in the last step (see my previous
> mails), but from looking at the bisection log, it's definitely one of
> your/Brians commit (sorry!), so it may be 3bd95dfb in combination with the
> other 4 changes. However, only with 3bd95dfb applied, the DomU wouldn't
> start at all. With the only other patches applied, the DomU would start,
> and then die with a GPF.
>
> Christian.
> --
> BOFH excuse #191:
>
> Just type 'mv * /dev/null'.
>

OK, perhaps the patch below is not _that_ stupid so I
would like to get it reviewed and tested if possible.
Just a thought. Wonder if it help but definitely it will
not harm anyway :)

-- Cyrill
---
x86: kernel_thread -- initialize SS to a known state

Before the kernel_thread was converted into "C" we had
pt_regs::ss set to __KERNEL_DS (by SAVE_ALL asm macro).

Though I must admit I didn't find any *explicit* load of
%ss from this structure the better to be on a safe side
and set it to a known value.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
arch/x86/kernel/process.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.git/arch/x86/kernel/process.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/process.c
+++ linux-2.6.git/arch/x86/kernel/process.c
@@ -288,6 +288,8 @@ int kernel_thread(int (*fn)(void *), voi
regs.es = __USER_DS;
regs.fs = __KERNEL_PERCPU;
regs.gs = __KERNEL_STACK_CANARY;
+#else
+ regs.ss = __KERNEL_DS;
#endif

regs.orig_ax = -1;

\
 
 \ /
  Last update: 2010-01-08 22:53    [W:0.092 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site