lkml.org 
[lkml]   [2019]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.2 49/85] powerpc: Add barrier_nospec to raw_copy_in_user()
    Date
    From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

    commit 6fbcdd59094ade30db63f32316e9502425d7b256 upstream.

    Commit ddf35cf3764b ("powerpc: Use barrier_nospec in copy_from_user()")
    Added barrier_nospec before loading from user-controlled pointers. The
    intention was to order the load from the potentially user-controlled
    pointer vs a previous branch based on an access_ok() check or similar.

    In order to achieve the same result, add a barrier_nospec to the
    raw_copy_in_user() function before loading from such a user-controlled
    pointer.

    Fixes: ddf35cf3764b ("powerpc: Use barrier_nospec in copy_from_user()")
    Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/powerpc/include/asm/uaccess.h | 1 +
    1 file changed, 1 insertion(+)

    --- a/arch/powerpc/include/asm/uaccess.h
    +++ b/arch/powerpc/include/asm/uaccess.h
    @@ -312,6 +312,7 @@ raw_copy_in_user(void __user *to, const
    {
    unsigned long ret;

    + barrier_nospec();
    allow_user_access(to, from, n);
    ret = __copy_tofrom_user(to, from, n);
    prevent_user_access(to, from, n);

    \
     
     \ /
      Last update: 2019-09-18 08:30    [W:2.271 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site