Hi,

On Fri, May 29, 2026 at 03:16:31PM +0800, Hongfu Li wrote:
> Add per-test tracing to the pkey signal-handler selftest and use
> pkey_assert() for error handling. Each test enables tracing at start
> and disables it at end; on failure, pkey_assert() calls abort_hooks()
> to turn tracing off so ftrace is not left enabled.
> 
> Signed-off-by: Hongfu Li <[email protected]>
> ---
>  .../selftests/mm/pkey_sighandler_tests.c      | 104 +++++++++---------
>  1 file changed, 50 insertions(+), 54 deletions(-)
>
> @@ -323,18 +323,18 @@ static void 
> test_sigsegv_handler_with_different_pkey_for_stack(void)
>       memset(&siginfo, 0, sizeof(siginfo));
>  
>       /* Use clone to avoid newer glibcs using rseq on new threads */
> -     long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> -                          CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> -                          CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> -                          CLONE_DETACHED,
> -                          stack + STACK_SIZE,
> -                          &parent_pid,
> -                          &child_pid);
> -
> -     if (ret < 0) {
> -             errno = -ret;
> +     child_pid = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> +                           CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> +                           CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> +                           CLONE_DETACHED,
> +                           stack + STACK_SIZE,
> +                           &parent_pid,
> +                           &child_pid);
> +
> +     if (child_pid < 0) {
> +             errno = -child_pid;

This change does not seem related at all to the patch.

>               perror("clone");
> -     } else if (ret == 0) {
> +     } else if (child_pid == 0) {
>               thread_segv_maperr_ptr(&sigstack);
>               syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
>       }
>
> @@ -494,23 +490,22 @@ static void test_pkru_sigreturn(void)
>       sigstack.ss_size = STACK_SIZE;
>  
>       /* Use clone to avoid newer glibcs using rseq on new threads */
> -     long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> -                          CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> -                          CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> -                          CLONE_DETACHED,
> -                          stack + STACK_SIZE,
> -                          &parent_pid,
> -                          &child_pid);
> -
> -     if (ret < 0) {
> -             errno = -ret;
> +     child_pid = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> +                           CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> +                           CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> +                           CLONE_DETACHED,
> +                           stack + STACK_SIZE,
> +                           &parent_pid,
> +                           &child_pid);
> +
> +     if (child_pid < 0) {
> +             errno = -child_pid;

Ditto.

>               perror("clone");
> -     }  else if (ret == 0) {
> +     } else if (child_pid == 0) {
>               thread_sigusr2_self(&sigstack);
>               syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
>       }
>  
> -     child_pid =  ret;
>       /* Check that thread exited */
>       do {
>               sched_yield();

-- 
Sincerely yours,
Mike.

Reply via email to