Re: [PATCH 12/14] powerpc/64s: system call avoid setting MSR[RI] until we set MSR[EE]
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2021-03-19 11:29:43
Christophe Leroy [off-list ref] writes:
Le 15/03/2021 à 23:04, Nicholas Piggin a écrit :quoted
This extends the MSR[RI]=0 window a little further into the system call in order to pair RI and EE enabling with a single mtmsrd.Time ago, I proposed to delay that on PPC32 and Michael objected, see https://patchwork.ozlabs.org/project/linuxppc-dev/patch/9f9dd859d571e324c7412ed9db9da8cfba678257.1548956511.git.christophe.leroy@c-s.fr/
I don't think I objected, I was just curious about what the added exposure to RI=0 was :) cheers
quoted
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index bd0c82ac9de5..2f14ac3c377c 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S@@ -1999,8 +1999,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) mtctr r10 bctr .else - li r10,MSR_RI - mtmsrd r10,1 /* Set RI (EE=0) */ #ifdef CONFIG_RELOCATABLE __LOAD_HANDLER(r10, system_call_common) mtctr r10diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index f28f41a1a85a..eef61800f734 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S@@ -311,10 +311,10 @@ END_BTB_FLUSH_SECTION * nothing pending. system_call_exception() will call * trace_hardirqs_off(). */ - li r11,IRQS_ALL_DISABLED - li r12,PACA_IRQ_HARD_DIS + li r11,IRQS_DISABLED + li r12,-1 /* Set MSR_EE and MSR_RI */ stb r11,PACAIRQSOFTMASK(r13) - stb r12,PACAIRQHAPPENED(r13) + mtmsrd r12,1 ENTER_KERNEL_SECURITY_FALLBACK