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.Signed-off-by: Hongfu Li <[email protected]> Acked-by: Mike Rapoport (Microsoft) <[email protected]> Acked-by: Liam R. Howlett (Oracle) <[email protected]> Reviewed-by: Kevin Brodsky <[email protected]> Tested-by: Kevin Brodsky <[email protected]> --- 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 8b3400379423..188513e94fc5 100644 --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c @@ -329,7 +329,7 @@ static void test_sigsegv_handler_with_different_pkey_for_stack(void) if (ret < 0) { errno = -ret; - perror("clone"); + pkey_assert(0); } else if (ret == 0) { thread_segv_maperr_ptr(&sigstack); syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0); @@ -502,7 +502,7 @@ static void test_pkru_sigreturn(void) if (ret < 0) { errno = -ret; - perror("clone"); + pkey_assert(0); } else if (ret == 0) { thread_sigusr2_self(&sigstack); syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0); -- 2.25.1

