[PATCH] powerpc/64: system call implement the bulk of the logic in C fix 2 (tabort_syscall)
Nicholas Piggin
npiggin at gmail.com
Tue Jan 28 11:18:54 AEDT 2020
Another incremental patch which fixes silly tabort_syscall bug that
causes kernel crashes when making system calls in transactional state.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
arch/powerpc/kernel/entry_64.S | 9 +++------
arch/powerpc/kernel/syscall_64.c | 4 ++--
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d0bb238805e6..94b3db203ec3 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -165,16 +165,13 @@ syscall_restore_regs:
b .Lsyscall_restore_regs_cont
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-_GLOBAL(tabort_syscall)
+_GLOBAL(tabort_syscall) /* (unsigned long nip, unsigned long msr) */
/* Firstly we need to enable TM in the kernel */
mfmsr r10
li r9, 1
rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG
mtmsrd r10, 0
- ld r11,_NIP(r13)
- ld r12,_MSR(r13)
-
/* tabort, this dooms the transaction, nothing else */
li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
TABORT(R9)
@@ -188,8 +185,8 @@ _GLOBAL(tabort_syscall)
li r9, MSR_RI
andc r10, r10, r9
mtmsrd r10, 1
- mtspr SPRN_SRR0, r11
- mtspr SPRN_SRR1, r12
+ mtspr SPRN_SRR0, r3
+ mtspr SPRN_SRR1, r4
RFI_TO_USER
b . /* prevent speculative execution */
#endif
diff --git a/arch/powerpc/kernel/syscall_64.c b/arch/powerpc/kernel/syscall_64.c
index cfe458adde07..69a4ef13973b 100644
--- a/arch/powerpc/kernel/syscall_64.c
+++ b/arch/powerpc/kernel/syscall_64.c
@@ -15,7 +15,7 @@
#include <asm/time.h>
#include <asm/unistd.h>
-extern void __noreturn tabort_syscall(void);
+extern void __noreturn tabort_syscall(unsigned long nip, unsigned long msr);
typedef long (*syscall_fn)(long, long, long, long, long, long);
@@ -30,7 +30,7 @@ notrace long system_call_exception(long r3, long r4, long r5, long r6, long r7,
if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
unlikely(regs->msr & MSR_TS_T))
- tabort_syscall();
+ tabort_syscall(regs->nip, regs->msr);
account_cpu_user_entry();
--
2.23.0
More information about the Linuxppc-dev
mailing list