lkml.org 
[lkml]   [2015]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 2/2] x86/mm: Silence KASAN warnings in get_wchan()
    Date
    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.

    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reported-by: Sasha Levin <sasha.levin@oracle.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;
    }
    --
    2.4.9


    \
     
     \ /
      Last update: 2015-10-19 11:01    [W:4.090 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site