From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41VHcc35sGzF3Hr for ; Tue, 17 Jul 2018 21:10:08 +1000 (AEST) From: Diana Craciun To: linuxppc-dev@lists.ozlabs.org Cc: mpe@ellerman.id.au, oss@buserror.net, leoyang.li@nxp.com, bharat.bhushan@nxp.com, Diana Craciun Subject: [PATCH v4 6/6] powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms Date: Tue, 17 Jul 2018 14:09:57 +0300 Message-Id: <1531825797-14236-7-git-send-email-diana.craciun@nxp.com> In-Reply-To: <1531825797-14236-1-git-send-email-diana.craciun@nxp.com> References: <1531825797-14236-1-git-send-email-diana.craciun@nxp.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Used barrier_nospec to sanitize the syscall table. Signed-off-by: Diana Craciun --- History: v2-->v3 - included in the series arch/powerpc/kernel/entry_32.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 973577f..8f05280 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -33,6 +33,7 @@ #include #include #include +#include /* * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE. @@ -358,6 +359,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 -- 2.5.5