Re: [PATCH v4 3/4] selftests/mm: use pkey_assert on clone_raw failure in pkey test
From: Mike Rapoport
Date: Sun May 31 2026 - 10:37:47 EST
Hi,
On Fri, May 29, 2026 at 03:16:32PM +0800, Hongfu Li wrote:
> Use pkey_assert(0) instead of perror("clone") when clone_raw() fails.
> The old path only printed an error and continued; the test now exits
> via pkey_assert() on failure so it does not hang or proceed with an
> invalid child.
Looks like clone() invocation changes in patch 2 belong here.
But is there actually a need to change ret = clone_raw() to
child_pid = clone_raw()?
> Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
> ---
> tools/testing/selftests/mm/pkey_sighandler_tests.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> index 80b5b3dad86f..231dfb079075 100644
> --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
> +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> @@ -333,7 +333,7 @@ static void test_sigsegv_handler_with_different_pkey_for_stack(void)
>
> if (child_pid < 0) {
> errno = -child_pid;
> - perror("clone");
> + pkey_assert(0);
> } else if (child_pid == 0) {
> thread_segv_maperr_ptr(&sigstack);
> syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
> @@ -500,7 +500,7 @@ static void test_pkru_sigreturn(void)
>
> if (child_pid < 0) {
> errno = -child_pid;
> - perror("clone");
> + pkey_assert(0);
> } else if (child_pid == 0) {
> thread_sigusr2_self(&sigstack);
> syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
> --
> 2.50.1
>
--
Sincerely yours,
Mike.