diff options
author | Vasily Gorbik <gor@linux.ibm.com> | 2019-08-13 13:23:51 -0400 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2019-08-21 06:58:53 -0400 |
commit | 2c7fa8a11cc528e49e88352fce8cf083104b3797 (patch) | |
tree | 5bdb4f2c07e83410c0cdd0b299aed23e489fb3b3 | |
parent | 8769f610fe6d473e5e8e221709c3ac402037da6c (diff) |
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 <iii@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r-- | arch/s390/kernel/process.c | 4 |
1 files 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) | |||
196 | goto out; | 196 | goto out; |
197 | } | 197 | } |
198 | for (count = 0; count < 16; count++) { | 198 | for (count = 0; count < 16; count++) { |
199 | sf = (struct stack_frame *) sf->back_chain; | 199 | sf = (struct stack_frame *)READ_ONCE_NOCHECK(sf->back_chain); |
200 | if (sf <= low || sf > high) { | 200 | if (sf <= low || sf > high) { |
201 | return_address = 0; | 201 | return_address = 0; |
202 | goto out; | 202 | goto out; |
203 | } | 203 | } |
204 | return_address = sf->gprs[8]; | 204 | return_address = READ_ONCE_NOCHECK(sf->gprs[8]); |
205 | if (!in_sched_functions(return_address)) | 205 | if (!in_sched_functions(return_address)) |
206 | goto out; | 206 | goto out; |
207 | } | 207 | } |