task_stack: Fix end_of_stack() for architectures with upwards-growing stack
authorHelge Deller <deller@gmx.de>
Mon, 4 Oct 2021 22:05:43 +0000 (00:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:21 +0000 (19:16 +0100)
commitf6ca0ac23202d55bcad44907aa720e7d9ee786fa
treed63311bd9766a59bc535cac252f407848eb0fce7
parent3b935cca35e461ca725d8cda9a4ea2b4259239d3
task_stack: Fix end_of_stack() for architectures with upwards-growing stack

[ Upstream commit 9cc2fa4f4a92ccc6760d764e7341be46ee8aaaa1 ]

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: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/sched/task_stack.h