From 2c7fa8a11cc528e49e88352fce8cf083104b3797 Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Tue, 13 Aug 2019 19:23:51 +0200 Subject: [PATCH] s390/kasan: avoid report in get_wchan Reading other running task's stack can be a dangerous endeavor. Kasan stack memory access instrumentation includes special prologue and epilogue to mark/remove red zones in shadow memory between stack variables. For that reason there is always a race between a task reading value in other task's stack and that other task returning from a function and entering another one generating different red zones pattern. To avoid kasan reports simply perform uninstrumented memory reads. Acked-by: Ilya Leoshkevich Signed-off-by: Vasily Gorbik --- arch/s390/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 9f2727bf3cbe..b0afec673f77 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -196,12 +196,12 @@ unsigned long get_wchan(struct task_struct *p) goto out; } for (count = 0; count < 16; count++) { - sf = (struct stack_frame *) sf->back_chain; + sf = (struct stack_frame *)READ_ONCE_NOCHECK(sf->back_chain); if (sf <= low || sf > high) { return_address = 0; goto out; } - return_address = sf->gprs[8]; + return_address = READ_ONCE_NOCHECK(sf->gprs[8]); if (!in_sched_functions(return_address)) goto out; } -- 2.45.2