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]>
---
 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 4438d8fb8ef8..9dfbe09cd87a 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 (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);
@@ -500,7 +500,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.50.1


Reply via email to