[PATCH v2 3/5] arm64: signal: Improve POR_EL0 handling to avoid uaccess failures

2024-10-23 Thread Kevin Brodsky
TL;DR: reset POR_EL0 to "allow all" before writing the signal frame, preventing spurious uaccess failures. Also, make sure that POR_EL0 remains unchanged if delivering the signal fails. When POE is supported, the POR_EL0 register constrains memory accesses based on the target page's POIndex (pkey)

[PATCH v2 1/5] arm64: signal: Remove unused macro

2024-10-23 Thread Kevin Brodsky
Commit 33f082614c34 ("arm64: signal: Allow expansion of the signal frame") introduced the BASE_SIGFRAME_SIZE macro but it has apparently never been used; just remove it. Reviewed-by: Dave Martin Acked-by: Catalin Marinas Signed-off-by: Kevin Brodsky --- arch/arm64/kernel/signal.c | 1 - 1 file

[PATCH v2 2/5] arm64: signal: Remove unnecessary check when saving POE state

2024-10-23 Thread Kevin Brodsky
The POE frame record is allocated unconditionally if POE is supported. If the allocation fails, a SIGSEGV is delivered before setup_sigframe() can be reached. As a result there is no need to consider poe_offset before saving POR_EL0; just remove that check. This is in line with other frame records

[PATCH v2 4/5] selftests/mm: Use generic pkey register manipulation

2024-10-23 Thread Kevin Brodsky
pkey_sighandler_tests.c currently hardcodes x86 PKRU encodings. The first step towards running those tests on arm64 is to abstract away the pkey register values. Since those tests want to deny access to all keys except a few, we have each arch define PKEY_ALLOW_NONE, the pkey register value denyin

[PATCH v2 5/5] selftests/mm: Enable pkey_sighandler_tests on arm64

2024-10-23 Thread Kevin Brodsky
pkey_sighandler_tests.c makes raw syscalls using its own helper, syscall_raw(). One of those syscalls is clone, which is problematic as every architecture has a different opinion on the order of its arguments. To complete arm64 support, we therefore add an appropriate implementation in syscall_raw

[PATCH v2 0/5] Improve arm64 pkeys handling in signal delivery

2024-10-23 Thread Kevin Brodsky
This series is a follow-up to Joey's Permission Overlay Extension (POE) series [1] that recently landed on mainline. The goal is to improve the way we handle the register that governs which pkeys/POIndex are accessible (POR_EL0) during signal delivery. As things stand, we may unexpectedly fail to w

Re: [PATCH] Add Selftest to test fork() syscall

2024-10-23 Thread Shuah Khan
On 10/23/24 15:11, Shivam Chaudhary wrote: On 24/10/24 2:15 AM, Shuah Khan wrote: On 10/22/24 14:42, Shivam Chaudhary wrote: This test verifies the correct behavior of the fork() system call, which creates a child process by duplicating the parent process. The test checks the following: - The

Re: [PATCH v2 4/5] selftests/mm: Use generic pkey register manipulation

2024-10-23 Thread Dave Hansen
On 10/23/24 08:05, Kevin Brodsky wrote: ...> diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h > index 5f28e26a2511..53ed9a336ffe 100644 > --- a/tools/testing/selftests/mm/pkey-x86.h > +++ b/tools/testing/selftests/mm/pkey-x86.h > @@ -34,6 +34,8 @@ > #defin

Re: [PATCH] Add Selftest to test fork() syscall

2024-10-23 Thread Shuah Khan
On 10/22/24 14:42, Shivam Chaudhary wrote: This test verifies the correct behavior of the fork() system call, which creates a child process by duplicating the parent process. The test checks the following: - The child PID returned by fork() is present in /proc. - The child PID is different from

Re: [PATCH] Add Selftest to test fork() syscall

2024-10-23 Thread Shivam Chaudhary
On 24/10/24 2:15 AM, Shuah Khan wrote: On 10/22/24 14:42, Shivam Chaudhary wrote: This test verifies the correct behavior of the fork() system call, which creates a child process by duplicating the parent process. The test checks the following: - The child PID returned by fork() is present in

Re: [PATCH net-next 4/8] selftests: net: lib: Move logging from forwarding/lib.sh here

2024-10-23 Thread Shuah Khan
On 10/22/24 08:50, Petr Machata wrote: Many net selftests invent their own logging helpers. These really should be in a library sourced by these tests. Currently forwarding/lib.sh has a suite of perfectly fine logging helpers, but sourcing a forwarding/ library from a higher-level directory smell