Commit 9cc2fa4f authored by Helge Deller's avatar Helge Deller

task_stack: Fix end_of_stack() for architectures with upwards-growing stack

The function end_of_stack() returns a pointer to the last entry of a
stack. For architectures like parisc where the stack grows upwards
return the pointer to the highest address in the stack.

Without this change I faced a crash on parisc, because the stackleak
functionality wrote STACKLEAK_POISON to the lowest address and thus
overwrote the first 4 bytes of the task_struct which included the
TIF_FLAGS.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent f06d6e92
...@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task) ...@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)
static inline unsigned long *end_of_stack(const struct task_struct *task) static inline unsigned long *end_of_stack(const struct task_struct *task)
{ {
#ifdef CONFIG_STACK_GROWSUP
return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1;
#else
return task->stack; return task->stack;
#endif
} }
#elif !defined(__HAVE_THREAD_FUNCTIONS) #elif !defined(__HAVE_THREAD_FUNCTIONS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment