]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms
authorDiana Craciun <diana.craciun@nxp.com>
Mon, 29 Apr 2019 15:49:05 +0000 (18:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 17:44:55 +0000 (19:44 +0200)
commit c28218d4abbf4f2035495334d8bfcba64bda4787 upstream.

Used barrier_nospec to sanitize the syscall table.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/entry_32.S

index 3728e617e17ef6f4c3205194c0f2dc101c984f30..609bc7d01f130251f0f31f5a2fd2f83e8f7bd43a 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/unistd.h>
 #include <asm/ftrace.h>
 #include <asm/ptrace.h>
+#include <asm/barrier.h>
 
 /*
  * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
@@ -340,6 +341,15 @@ syscall_dotrace_cont:
        ori     r10,r10,sys_call_table@l
        slwi    r0,r0,2
        bge-    66f
+
+       barrier_nospec_asm
+       /*
+        * Prevent the load of the handler below (based on the user-passed
+        * system call number) being speculatively executed until the test
+        * against NR_syscalls and branch to .66f above has
+        * committed.
+        */
+
        lwzx    r10,r10,r0      /* Fetch system call handler [ptr] */
        mtlr    r10
        addi    r9,r1,STACK_FRAME_OVERHEAD