[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>
This commit is contained in:

committed by
Linus Torvalds

parent
06b425d80f
commit
07b047fc24
@@ -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; \
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user