Commit 2c7fa8a1 authored by Vasily Gorbik's avatar Vasily Gorbik

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: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 8769f610
...@@ -196,12 +196,12 @@ unsigned long get_wchan(struct task_struct *p) ...@@ -196,12 +196,12 @@ unsigned long get_wchan(struct task_struct *p)
goto out; goto out;
} }
for (count = 0; count < 16; count++) { 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) { if (sf <= low || sf > high) {
return_address = 0; return_address = 0;
goto out; goto out;
} }
return_address = sf->gprs[8]; return_address = READ_ONCE_NOCHECK(sf->gprs[8]);
if (!in_sched_functions(return_address)) if (!in_sched_functions(return_address))
goto out; goto out;
} }
......
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