]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Fri, 11 Sep 2020 10:29:15 +0000 (10:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:51:44 +0000 (11:51 +0100)
commit 2c637d2df4ee4830e9d3eb2bd5412250522ce96e upstream.

low_sleep_handler() has an hardcoded restore of segment registers
that doesn't take KUAP and KUEP into account.

Use head_32's load_segment_registers() routine instead.

Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/21b05f7298c1b18f73e6e5b4cd5005aafa24b6da.1599820109.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/head_32.S
arch/powerpc/platforms/powermac/sleep.S

index f3ab94d73936d3eed5dd2ef87afaa86dae104eb3..63b0ebfa34965f9cb81e0c273bc6020ec2be75d1 100644 (file)
@@ -1002,7 +1002,7 @@ BEGIN_MMU_FTR_SECTION
 END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
        blr
 
-load_segment_registers:
+_GLOBAL(load_segment_registers)
        li      r0, NUM_USER_SEGMENTS /* load up user segment register values */
        mtctr   r0              /* for context 0 */
        li      r3, 0           /* Kp = 0, Ks = 0, VSID = 0 */
index f9a680fdd9c4b501e3c86865fb557a29d9574592..51bfdfe85058ccb7081977f7f88e1e5e9c929ffa 100644 (file)
@@ -294,14 +294,7 @@ grackle_wake_up:
         * we do any r1 memory access as we are not sure they
         * are in a sane state above the first 256Mb region
         */
-       li      r0,16           /* load up segment register values */
-       mtctr   r0              /* for context 0 */
-       lis     r3,0x2000       /* Ku = 1, VSID = 0 */
-       li      r4,0
-3:     mtsrin  r3,r4
-       addi    r3,r3,0x111     /* increment VSID */
-       addis   r4,r4,0x1000    /* address of next segment */
-       bdnz    3b
+       bl      load_segment_registers
        sync
        isync