* [PATCH] powerpc/pseries: Fix plpks crash on non-pseries
@ 2022-09-07 6:50 Michael Ellerman
2022-09-07 15:37 ` Nathan Chancellor
2022-09-09 11:08 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-09-07 6:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: nathan
As reported[1] by Nathan, the recently added plpks driver will crash if
it's built into the kernel and booted on a non-pseries machine, eg
powernv:
kernel BUG at arch/powerpc/kernel/syscall.c:39!
Oops: Exception in kernel mode, sig: 5 [#1]
LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
...
NIP system_call_exception+0x90/0x3d0
LR system_call_common+0xec/0x250
Call Trace:
0xc0000000035c3e10 (unreliable)
system_call_common+0xec/0x250
--- interrupt: c00 at plpar_hcall+0x38/0x60
NIP: c0000000000e4300 LR: c00000000202945c CTR: 0000000000000000
REGS: c0000000035c3e80 TRAP: 0c00 Not tainted (6.0.0-rc4)
MSR: 9000000002009033 <SF,HV,VEC,EE,ME,IR,DR,RI,LE> CR: 28000284 XER: 00000000
...
NIP plpar_hcall+0x38/0x60
LR pseries_plpks_init+0x64/0x23c
--- interrupt: c00
On powernv Linux is the hypervisor, so a hypercall just ends up going to
the syscall path, which BUGs if the syscall (hypercall) didn't come from
userspace.
The fix is simply to not probe the plpks driver on non-pseries machines.
[1] https://lore.kernel.org/linuxppc-dev/Yxe06fbq18Wv9y3W@dev-arch.thelio-3990X/
Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/platforms/pseries/plpks.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 52aaa2894606..f4b5b5a64db3 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/types.h>
#include <asm/hvcall.h>
+#include <asm/machdep.h>
#include "plpks.h"
@@ -457,4 +458,4 @@ static __init int pseries_plpks_init(void)
return rc;
}
-arch_initcall(pseries_plpks_init);
+machine_arch_initcall(pseries, pseries_plpks_init);
--
2.37.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] powerpc/pseries: Fix plpks crash on non-pseries
2022-09-07 6:50 [PATCH] powerpc/pseries: Fix plpks crash on non-pseries Michael Ellerman
@ 2022-09-07 15:37 ` Nathan Chancellor
2022-09-09 11:08 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-09-07 15:37 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Wed, Sep 07, 2022 at 04:50:38PM +1000, Michael Ellerman wrote:
> As reported[1] by Nathan, the recently added plpks driver will crash if
> it's built into the kernel and booted on a non-pseries machine, eg
> powernv:
>
> kernel BUG at arch/powerpc/kernel/syscall.c:39!
> Oops: Exception in kernel mode, sig: 5 [#1]
> LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
> ...
> NIP system_call_exception+0x90/0x3d0
> LR system_call_common+0xec/0x250
> Call Trace:
> 0xc0000000035c3e10 (unreliable)
> system_call_common+0xec/0x250
> --- interrupt: c00 at plpar_hcall+0x38/0x60
> NIP: c0000000000e4300 LR: c00000000202945c CTR: 0000000000000000
> REGS: c0000000035c3e80 TRAP: 0c00 Not tainted (6.0.0-rc4)
> MSR: 9000000002009033 <SF,HV,VEC,EE,ME,IR,DR,RI,LE> CR: 28000284 XER: 00000000
> ...
> NIP plpar_hcall+0x38/0x60
> LR pseries_plpks_init+0x64/0x23c
> --- interrupt: c00
>
> On powernv Linux is the hypervisor, so a hypercall just ends up going to
> the syscall path, which BUGs if the syscall (hypercall) didn't come from
> userspace.
>
> The fix is simply to not probe the plpks driver on non-pseries machines.
>
> [1] https://lore.kernel.org/linuxppc-dev/Yxe06fbq18Wv9y3W@dev-arch.thelio-3990X/
>
> Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Thanks!
> ---
> arch/powerpc/platforms/pseries/plpks.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
> index 52aaa2894606..f4b5b5a64db3 100644
> --- a/arch/powerpc/platforms/pseries/plpks.c
> +++ b/arch/powerpc/platforms/pseries/plpks.c
> @@ -17,6 +17,7 @@
> #include <linux/string.h>
> #include <linux/types.h>
> #include <asm/hvcall.h>
> +#include <asm/machdep.h>
>
> #include "plpks.h"
>
> @@ -457,4 +458,4 @@ static __init int pseries_plpks_init(void)
>
> return rc;
> }
> -arch_initcall(pseries_plpks_init);
> +machine_arch_initcall(pseries, pseries_plpks_init);
> --
> 2.37.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] powerpc/pseries: Fix plpks crash on non-pseries
2022-09-07 6:50 [PATCH] powerpc/pseries: Fix plpks crash on non-pseries Michael Ellerman
2022-09-07 15:37 ` Nathan Chancellor
@ 2022-09-09 11:08 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-09-09 11:08 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: nathan
On Wed, 7 Sep 2022 16:50:38 +1000, Michael Ellerman wrote:
> As reported[1] by Nathan, the recently added plpks driver will crash if
> it's built into the kernel and booted on a non-pseries machine, eg
> powernv:
>
> kernel BUG at arch/powerpc/kernel/syscall.c:39!
> Oops: Exception in kernel mode, sig: 5 [#1]
> LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
> ...
> NIP system_call_exception+0x90/0x3d0
> LR system_call_common+0xec/0x250
> Call Trace:
> 0xc0000000035c3e10 (unreliable)
> system_call_common+0xec/0x250
> --- interrupt: c00 at plpar_hcall+0x38/0x60
> NIP: c0000000000e4300 LR: c00000000202945c CTR: 0000000000000000
> REGS: c0000000035c3e80 TRAP: 0c00 Not tainted (6.0.0-rc4)
> MSR: 9000000002009033 <SF,HV,VEC,EE,ME,IR,DR,RI,LE> CR: 28000284 XER: 00000000
> ...
> NIP plpar_hcall+0x38/0x60
> LR pseries_plpks_init+0x64/0x23c
> --- interrupt: c00
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/pseries: Fix plpks crash on non-pseries
https://git.kernel.org/powerpc/c/a66de5283e16602b74658289360505ceeb308c90
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/pseries: Fix plpks crash on non-pseries
@ 2022-09-07 9:36 Dan Horák
0 siblings, 0 replies; 4+ messages in thread
From: Dan Horák @ 2022-09-07 9:36 UTC (permalink / raw)
To: mpe; +Cc: nathan, linuxppc-dev
Hi,
I have tested the fix on top of Fedora's
kernel-6.0.0-0.rc4.20220906git53e99dcff61e.32.fc38 and systems are
booting again.
Tested-By: Dan Horák <dan@danny.cz>
Reviewed-by: Dan Horák <dan@danny.cz>
With regards,
Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-09 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07 6:50 [PATCH] powerpc/pseries: Fix plpks crash on non-pseries Michael Ellerman
2022-09-07 15:37 ` Nathan Chancellor
2022-09-09 11:08 ` Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2022-09-07 9:36 Dan Horák
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox