* [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
@ 2020-09-01 7:35 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-09-01 7:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linux-kernel, linuxppc-dev
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.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
Cc: stable@vger.kernel.org
---
arch/powerpc/platforms/powermac/sleep.S | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index f9a680fdd9c4..51bfdfe85058 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -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
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
@ 2020-09-01 7:35 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-09-01 7:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
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.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
Cc: stable@vger.kernel.org
---
arch/powerpc/platforms/powermac/sleep.S | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index f9a680fdd9c4..51bfdfe85058 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -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
--
2.25.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
2020-09-01 7:35 ` Christophe Leroy
@ 2020-09-10 23:56 ` Michael Ellerman
-1 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-09-10 23:56 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linux-kernel, linuxppc-dev
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 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.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
> Cc: stable@vger.kernel.org
> ---
> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
Doesn't build? pmac32_defconfig, gcc 9.3.0:
ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
(.text+0x25c): undefined reference to `load_segment_registers'
Missing _GLOBAL() presumably?
cheers
> diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
> index f9a680fdd9c4..51bfdfe85058 100644
> --- a/arch/powerpc/platforms/powermac/sleep.S
> +++ b/arch/powerpc/platforms/powermac/sleep.S
> @@ -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
>
> --
> 2.25.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
@ 2020-09-10 23:56 ` Michael Ellerman
0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-09-10 23:56 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 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.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
> Cc: stable@vger.kernel.org
> ---
> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
Doesn't build? pmac32_defconfig, gcc 9.3.0:
ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
(.text+0x25c): undefined reference to `load_segment_registers'
Missing _GLOBAL() presumably?
cheers
> diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
> index f9a680fdd9c4..51bfdfe85058 100644
> --- a/arch/powerpc/platforms/powermac/sleep.S
> +++ b/arch/powerpc/platforms/powermac/sleep.S
> @@ -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
>
> --
> 2.25.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
2020-09-10 23:56 ` Michael Ellerman
@ 2020-09-11 10:30 ` Christophe Leroy
-1 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-09-11 10:30 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: linux-kernel, linuxppc-dev
Le 11/09/2020 à 01:56, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> 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.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
>> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
>> Cc: stable@vger.kernel.org
>> ---
>> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
>> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> Doesn't build? pmac32_defconfig, gcc 9.3.0:
>
> ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
> (.text+0x25c): undefined reference to `load_segment_registers'
>
> Missing _GLOBAL() presumably?
Oops .. :(
v2 sent out.
Thanks
Christophe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
@ 2020-09-11 10:30 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2020-09-11 10:30 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
Le 11/09/2020 à 01:56, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> 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.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
>> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
>> Cc: stable@vger.kernel.org
>> ---
>> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
>> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> Doesn't build? pmac32_defconfig, gcc 9.3.0:
>
> ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
> (.text+0x25c): undefined reference to `load_segment_registers'
>
> Missing _GLOBAL() presumably?
Oops .. :(
v2 sent out.
Thanks
Christophe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
2020-09-11 10:30 ` Christophe Leroy
@ 2020-09-11 13:06 ` Michael Ellerman
-1 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-09-11 13:06 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linux-kernel, linuxppc-dev
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 11/09/2020 à 01:56, Michael Ellerman a écrit :
>> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>>> 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.
>>>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
>>> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
>>> Cc: stable@vger.kernel.org
>>> ---
>>> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
>>> 1 file changed, 1 insertion(+), 8 deletions(-)
>>
>> Doesn't build? pmac32_defconfig, gcc 9.3.0:
>>
>> ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
>> (.text+0x25c): undefined reference to `load_segment_registers'
>>
>> Missing _GLOBAL() presumably?
>
> Oops .. :(
>
> v2 sent out.
Thanks.
cheers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
@ 2020-09-11 13:06 ` Michael Ellerman
0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-09-11 13:06 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 11/09/2020 à 01:56, Michael Ellerman a écrit :
>> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>>> 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.
>>>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
>>> Fixes: 31ed2b13c48d ("powerpc/32s: Implement Kernel Userspace Execution Prevention.")
>>> Cc: stable@vger.kernel.org
>>> ---
>>> arch/powerpc/platforms/powermac/sleep.S | 9 +--------
>>> 1 file changed, 1 insertion(+), 8 deletions(-)
>>
>> Doesn't build? pmac32_defconfig, gcc 9.3.0:
>>
>> ld: arch/powerpc/platforms/powermac/sleep.o: in function `core99_wake_up':
>> (.text+0x25c): undefined reference to `load_segment_registers'
>>
>> Missing _GLOBAL() presumably?
>
> Oops .. :(
>
> v2 sent out.
Thanks.
cheers
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-11 13:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 7:35 [PATCH] powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP Christophe Leroy
2020-09-01 7:35 ` Christophe Leroy
2020-09-10 23:56 ` Michael Ellerman
2020-09-10 23:56 ` Michael Ellerman
2020-09-11 10:30 ` Christophe Leroy
2020-09-11 10:30 ` Christophe Leroy
2020-09-11 13:06 ` Michael Ellerman
2020-09-11 13:06 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.