summaryrefslogtreecommitdiffstats
path: root/include/asm-i386/processor.h
diff options
context:
space:
mode:
authorakpm@osdl.org <akpm@osdl.org>2006-01-12 10:05:41 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 18:08:52 +0100
commit07b047fc2466249aff7cdb23fa0b0955a7a00d48 (patch)
treeaf22cc80470f8aff6d0c25276ef8fae2b3f537a7 /include/asm-i386/processor.h
parent[PATCH] i386: task_thread_info() (diff)
downloadlinux-07b047fc2466249aff7cdb23fa0b0955a7a00d48.tar.xz
linux-07b047fc2466249aff7cdb23fa0b0955a7a00d48.zip
[PATCH] i386: fix task_pt_regs()
) From: Al Viro <viro@ftp.linux.org.uk> task_pt_regs() needs the same offset-by-8 to match copy_thread() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to '')
-rw-r--r--include/asm-i386/processor.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 13ecf66b098c..29ad87e9123f 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -561,10 +561,20 @@ unsigned long get_wchan(struct task_struct *p);
(unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
})
+/*
+ * The below -8 is to reserve 8 bytes on top of the ring0 stack.
+ * This is necessary to guarantee that the entire "struct pt_regs"
+ * is accessable even if the CPU haven't stored the SS/ESP registers
+ * on the stack (interrupt gate does not save these registers
+ * when switching to the same priv ring).
+ * Therefore beware: accessing the xss/esp fields of the
+ * "struct pt_regs" is possible, but they may contain the
+ * completely wrong values.
+ */
#define task_pt_regs(task) \
({ \
struct pt_regs *__regs__; \
- __regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info); \
+ __regs__ = (struct pt_regs *)(KSTK_TOP((task)->thread_info)-8); \
__regs__ - 1; \
})