Re: [PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC64

2022-01-07 Thread Naveen N. Rao
Christophe Leroy wrote: Le 27/07/2021 à 08:55, Jordan Niethe a écrit : Implement commit 40272035e1d0 ("powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32") for PPC64. When the BPF routine doesn't call any function, the non volatile registers can be reallocated

Re: Linux kernel: powerpc: KVM guest can trigger host crash on Power8

2022-01-07 Thread John Paul Adrian Glaubitz
Hi Michael! On 1/6/22 11:58, Michael Ellerman wrote: >> We're currently running 5.15.x on the host system and the guests and the >> testsuite >> for gcc-9 still reproducibly kills the KVM host. > > Have you been able to try the different -smp options I suggested? > > Can you separately test

Re: [PATCH 2/3] powerpc/bpf: Use helper for mapping bpf to ppc registers on PPC64

2022-01-07 Thread Naveen N. Rao
Jordan Niethe wrote: Prepare for doing commit 40272035e1d0 ("powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32") on PPC64 in a later patch. Instead of directly accessing the const b2p[] array for mapping bpf to ppc registers use bpf_to_ppc() which allows per

Re: [PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping

2022-01-07 Thread Naveen N. Rao
Jordan Niethe wrote: In bpf_jit_build_body(), the mapping of TMP_REG_1 and TMP_REG_2's bpf register to ppc register is evalulated at every use despite not changing. Instead, determine the ppc register once and store the result. This will be more useful when a later patch introduces a more

Re: [PATCH 4/9] powerpc/bpf: Handle large branch ranges with BPF_EXIT

2022-01-07 Thread Naveen N. Rao
Christophe Leroy wrote: Le 04/10/2021 à 20:24, Naveen N. Rao a écrit : Christophe Leroy wrote: Le 01/10/2021 à 23:14, Naveen N. Rao a écrit : In some scenarios, it is possible that the program epilogue is outside the branch range for a BPF_EXIT instruction. Instead of rejecting such

[PATCH v3 0/6] KEXEC_SIG with appended signature

2022-01-07 Thread Michal Suchanek
Hello, This is a refresh of the KEXEC_SIG series. This adds KEXEC_SIG support on powerpc and deduplicates the code dealing with appended signatures in the kernel. powerpc supports IMA_KEXEC but that's an exception rather than the norm. On the other hand, KEXEC_SIG is portable across platforms.

[PATCH v3 1/6] s390/kexec_file: Don't opencode appended signature check.

2022-01-07 Thread Michal Suchanek
Module verification already implements appeded signature check. Reuse it for kexec_file. Note: the kexec_file implementation uses EKEYREJECTED error in some cases when there is no key and the common implementation uses ENOPKG or EBADMSG instead. Signed-off-by: Michal Suchanek Acked-by: Heiko

[PATCH v3 RESEND 2/3] selftests/powerpc: Add test for real address error handling

2022-01-07 Thread Ganesh Goudar
Add test for real address or control memory address access error handling, using NX-GZIP engine. The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction

Re: [PATCH v2 8/8] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32

2022-01-07 Thread Naveen N. Rao
Christophe Leroy wrote: When the BPF routine doesn't call any function, the non volatile registers can be reallocated to volatile registers in order to avoid having to save them/restore on the stack. Before this patch, the test #359 ADD default X is: 0: 7c 64 1b 78 mr r4,r3 4:

[PATCH v3 5/6] module: Use key_being_used_for for log messages in verify_appended_signature

2022-01-07 Thread Michal Suchanek
Add value for kexec appended signature and pass in key_being_used_for enum rather than a string to verify_appended_signature to produce log messages about the signature. Signed-off-by: Michal Suchanek --- arch/powerpc/kexec/elf_64.c | 2 +- arch/s390/kernel/machine_kexec_file.c

[PATCH v3 6/6] module: Move duplicate mod_check_sig users code to mod_parse_sig

2022-01-07 Thread Michal Suchanek
Multiple users of mod_check_sig check for the marker, then call mod_check_sig, extract signature length, and remove the signature. Put this code in one place together with mod_check_sig. Note: This changes the error from ENOENT to ENODATA for ima_read_modsig in the case the signature marker is

[PATCH v3 4/6] module: strip the signature marker in the verification function.

2022-01-07 Thread Michal Suchanek
It is stripped by each caller separately. Note: this changes the error for kexec_file from EKEYREJECTED to ENODATA when the signature marker is missing. Signed-off-by: Michal Suchanek --- v3: - Philipp Rudo : Update the commit with note about change of raturn value - the

[PATCH v3 3/6] kexec_file: Don't opencode appended signature verification.

2022-01-07 Thread Michal Suchanek
Module verification already implements appeded signature verification. Reuse it for kexec_file. Signed-off-by: Michal Suchanek --- v3: - Philipp Rudo : Update the dependency on MODULE_SIG_FORMAT to MODULE_SIG - Include linux/verification.h - previously added in earlier patch ---

Re: [PATCH v2 6/7] KVM: PPC: mmio: Return to guest after emulation failure

2022-01-07 Thread Fabiano Rosas
Alexey Kardashevskiy writes: > On 07/01/2022 07:03, Fabiano Rosas wrote: >> If MMIO emulation fails we don't want to crash the whole guest by >> returning to userspace. >> >> The original commit bbf45ba57eae ("KVM: ppc: PowerPC 440 KVM >> implementation") added a todo: >> >>/* XXX Deliver

[PATCH v3 RESEND 3/3] powerpc/mce: Modify the real address error logging messages

2022-01-07 Thread Ganesh Goudar
To avoid ambiguity, modify the strings in real address error logging messages to "foreign/control memory" from "foreign", Since the error discriptions in P9 user manual and P10 user manual are different for same type of errors. P9 User Manual for MCE: DSISR:59 Host real address to foreign space

[PATCH v3 RESEND 1/3] powerpc/pseries: Parse control memory access error

2022-01-07 Thread Ganesh Goudar
Add support to parse and log control memory access error for pseries. These changes are made according to PAPR v2.11 10.3.2.2.12. Signed-off-by: Ganesh Goudar --- arch/powerpc/platforms/pseries/ras.c | 36 1 file changed, 32 insertions(+), 4 deletions(-) diff --git

[PATCH v3 2/6] powerpc/kexec_file: Add KEXEC_SIG support.

2022-01-07 Thread Michal Suchanek
Copy the code from s390x Both powerpc and s390x use appended signature format (as opposed to EFI based patforms using PE format). Signed-off-by: Michal Suchanek --- v3: - Philipp Rudo : Update the comit message with explanation why the s390 code is usable on powerpc. - Include correct

Re: [PATCH 01/13] bpf: Guard against accessing NULL pt_regs in bpf_get_task_stack()

2022-01-07 Thread Daniel Borkmann
On 1/6/22 12:45 PM, Naveen N. Rao wrote: task_pt_regs() can return NULL on powerpc for kernel threads. This is then used in __bpf_get_stack() to check for user mode, resulting in a kernel oops. Guard against this by checking return value of task_pt_regs() before trying to obtain the call chain.

[Bug 215389] pagealloc: memory corruption at building glibc-2.33 and running its' testsuite

2022-01-07 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=215389 --- Comment #4 from Erhard F. (erhar...@mailbox.org) --- I was able to easily reproduce this on 5.15.13, however not on 5.16-rc8. But on 5.16-rc8 I got this the 3rd time I ran the glibc testsuite: [...] watchdog: BUG: soft lockup - CPU#1 stuck

[PATCH v3 4/6] KVM: PPC: mmio: Queue interrupt at kvmppc_emulate_mmio

2022-01-07 Thread Fabiano Rosas
If MMIO emulation fails, we queue a Program interrupt to the guest. Move that line up into kvmppc_emulate_mmio, which is where we set RESUME_GUEST/HOST. This allows the removal of the 'advance' variable. No functional change, just separation of responsibilities. Signed-off-by: Fabiano Rosas ---

[PATCH v3 0/6] KVM: PPC: MMIO fixes

2022-01-07 Thread Fabiano Rosas
This v3 addresses review comments: Merge patches 3 and 7, now patch 6, which returns EMULATE_FAIL and now also alters the error message. Remove the now unnecessary 'advance' variable from emulate_loadstore in patch 4. v2: https://lore.kernel.org/r/20220106200304.4070825-1-faro...@linux.ibm.com

[PATCH v3 3/6] KVM: PPC: Don't use pr_emerg when mmio emulation fails

2022-01-07 Thread Fabiano Rosas
If MMIO emulation fails we deliver a Program interrupt to the guest. This is a normal event for the host, so use pr_info. Signed-off-by: Fabiano Rosas --- arch/powerpc/kvm/powerpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/powerpc.c

[PATCH v3 5/6] KVM: PPC: mmio: Return to guest after emulation failure

2022-01-07 Thread Fabiano Rosas
If MMIO emulation fails we don't want to crash the whole guest by returning to userspace. The original commit bbf45ba57eae ("KVM: ppc: PowerPC 440 KVM implementation") added a todo: /* XXX Deliver Program interrupt to guest. */ and later the commit d69614a295ae ("KVM: PPC: Separate loadstore

[PATCH v3 6/6] KVM: PPC: mmio: Reject instructions that access more than mmio.data size

2022-01-07 Thread Fabiano Rosas
The MMIO interface between the kernel and userspace uses a structure that supports a maximum of 8-bytes of data. Instructions that access more than that need to be emulated in parts. We currently don't have generic support for splitting the emulation in parts and each set of instructions needs to

[PATCH v3 2/6] KVM: PPC: Fix vmx/vsx mixup in mmio emulation

2022-01-07 Thread Fabiano Rosas
The MMIO emulation code for vector instructions is duplicated between VSX and VMX. When emulating VMX we should check the VMX copy size instead of the VSX one. Fixes: acc9eb9305fe ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction ...") Signed-off-by: Fabiano Rosas Reviewed-by: Nicholas

[PATCH v3 1/6] KVM: PPC: Book3S HV: Stop returning internal values to userspace

2022-01-07 Thread Fabiano Rosas
Our kvm_arch_vcpu_ioctl_run currently returns the RESUME_HOST values to userspace, against the API of the KVM_RUN ioctl which returns 0 on success. Signed-off-by: Fabiano Rosas Reviewed-by: Nicholas Piggin --- This was noticed while enabling the kvm selftests for powerpc. There's an assert at