[tip:x86/urgent] x86: kernel_thread() -- initialize SS to a known state

From: tip-bot for Cyrill Gorcunov
Date: Wed Jan 13 2010 - 11:40:25 EST


Commit-ID: 864a0922dd128392467611d9857e5138c6a91999
Gitweb: http://git.kernel.org/tip/864a0922dd128392467611d9857e5138c6a91999
Author: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
AuthorDate: Wed, 13 Jan 2010 10:16:07 +0000
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Wed, 13 Jan 2010 11:23:45 +0100

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@xxxxxxxxxx>
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Christian Kujau <lists@xxxxxxxxxxxxxxx>
Cc: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@xxxxxxxxxx>
Cc: Brian Gerst <brgerst@xxxxxxxxx>
LKML-Reference: <1263377768-19600-1-git-send-email-ian.campbell@xxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
arch/x86/kernel/process.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c6ee241..02c3ee0 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -288,6 +288,8 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
regs.es = __USER_DS;
regs.fs = __KERNEL_PERCPU;
regs.gs = __KERNEL_STACK_CANARY;
+#else
+ regs.ss = __KERNEL_DS;
#endif

regs.orig_ax = -1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/