diff options
author | Andi Kleen <ak@suse.de> | 2006-10-05 18:47:22 +0200 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-10-05 18:47:22 +0200 |
commit | 51ec28e1b2cb267a09a0b8eac1ccf8d61b7268bf (patch) | |
tree | 4686d439a49b98b98fc5048641ddfb50db3fbcd6 /arch/i386/kernel/process.c | |
parent | f015c6c4d733f68cbc1c5d231bb158abaa5c9606 (diff) | |
download | op-kernel-dev-51ec28e1b2cb267a09a0b8eac1ccf8d61b7268bf.zip op-kernel-dev-51ec28e1b2cb267a09a0b8eac1ccf8d61b7268bf.tar.gz |
[PATCH] x86: Terminate the kernel stacks for the unwinder
Always make sure RIP/EIP is 0 in the registers stored on the top
of the stack of a kernel thread. This makes sure the unwinder code
won't try a fallback but knows the stack has ended.
AK: this patch is a bit mysterious. in theory they should be terminated
anyways, but it seems to fix at least one crash. Anyways double termination
probably doesn't hurt.
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/kernel/process.c')
-rw-r--r-- | arch/i386/kernel/process.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index dad02a9..b0a0780 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -328,6 +328,7 @@ extern void kernel_thread_helper(void); int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { struct pt_regs regs; + int err; memset(®s, 0, sizeof(regs)); @@ -342,7 +343,10 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; /* Ok, create the new process.. */ - return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); + err = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); + if (err == 0) /* terminate kernel stack */ + task_pt_regs(current)->eip = 0; + return err; } EXPORT_SYMBOL(kernel_thread); |