Skip to content

Commit 3a62e9f

Browse files
npiggingregkh
authored andcommitted
powerpc/tm: do not use r13 for tabort_syscall
commit cc7786d upstream. tabort_syscall runs with RI=1, so a nested recoverable machine check will load the paca into r13 and overwrite what we loaded it with, because exceptions returning to privileged mode do not restore r13. Fixes: b4b56f9 (powerpc/tm: Abort syscalls in active transactions) Signed-off-by: Nick Piggin <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d0a2b13 commit 3a62e9f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/powerpc/kernel/entry_64.S

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,22 +368,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
368368
tabort_syscall:
369369
/* Firstly we need to enable TM in the kernel */
370370
mfmsr r10
371-
li r13, 1
372-
rldimi r10, r13, MSR_TM_LG, 63-MSR_TM_LG
371+
li r9, 1
372+
rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG
373373
mtmsrd r10, 0
374374

375375
/* tabort, this dooms the transaction, nothing else */
376-
li r13, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
377-
TABORT(R13)
376+
li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
377+
TABORT(R9)
378378

379379
/*
380380
* Return directly to userspace. We have corrupted user register state,
381381
* but userspace will never see that register state. Execution will
382382
* resume after the tbegin of the aborted transaction with the
383383
* checkpointed register state.
384384
*/
385-
li r13, MSR_RI
386-
andc r10, r10, r13
385+
li r9, MSR_RI
386+
andc r10, r10, r9
387387
mtmsrd r10, 1
388388
mtspr SPRN_SRR0, r11
389389
mtspr SPRN_SRR1, r12

0 commit comments

Comments
 (0)