Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245727
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() |
| Date | 2015-10-13 15:50 +0200 |
| Message-ID | <qj87M-8dT-17@gated-at.bofh.it> (permalink) |
| References | <qj721-6Fq-17@gated-at.bofh.it> <qj721-6Fq-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> get_wchan() is racy by design, it may access volatile stack
> of running task, thus it may access redzone in a stack frame
> and cause KASAN to warn about this.
>
> Use READ_ONCE_NOCHECK() to silence these warnings.
>
> Reported-by: Sasha Levin <sasha.levin@oracle.com>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> arch/x86/kernel/process.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 39e585a..e28db18 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -550,14 +550,14 @@ unsigned long get_wchan(struct task_struct *p)
> if (sp < bottom || sp > top)
> return 0;
>
> - fp = READ_ONCE(*(unsigned long *)sp);
> + fp = READ_ONCE_NOCHECK(*(unsigned long *)sp);
> do {
> if (fp < bottom || fp > top)
> return 0;
> - ip = READ_ONCE(*(unsigned long *)(fp + sizeof(unsigned long)));
> + ip = READ_ONCE_NOCHECK(*(unsigned long *)(fp + sizeof(unsigned long)));
> if (!in_sched_functions(ip))
> return ip;
> - fp = READ_ONCE(*(unsigned long *)fp);
> + fp = READ_ONCE_NOCHECK(*(unsigned long *)fp);
> } while (count++ < 16 && p->state != TASK_RUNNING);
> return 0;
> }
Hm, exactly how is the 'red zone' defined? Is this about the current task mostly,
or when doing get_wchan() on other tasks?
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-10-13 14:40 +0200
Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Ingo Molnar <mingo@kernel.org> - 2015-10-13 15:50 +0200
Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-10-13 16:00 +0200
Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Dmitry Vyukov <dvyukov@google.com> - 2015-10-13 16:00 +0200
Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-10-13 16:20 +0200
Re: [PATCH v2 2/2] x86/process: Silence KASAN warnings in get_wchan() Ingo Molnar <mingo@kernel.org> - 2015-10-13 16:30 +0200
csiph-web