]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc: Add barrier_nospec to raw_copy_in_user()
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Wed, 6 Mar 2019 01:10:38 +0000 (12:10 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Sep 2019 07:08:05 +0000 (09:08 +0200)
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

index bd6d0fb5be9fb9b56bbbe108f334998ebd7d18e8..51f00c00d7e4905c2deb05f5a5807411072691c6 100644 (file)
@@ -280,6 +280,7 @@ extern unsigned long __copy_tofrom_user(void __user *to,
 static inline unsigned long
 raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
 {
+       barrier_nospec();
        return __copy_tofrom_user(to, from, n);
 }
 #endif /* __powerpc64__ */