On 30/06/2026 09:32, Hongfu Li wrote:
> Add missing pthread_create() return checks in pkey sighandler tests
> to avoid hanging in pthread_cond_wait() when thread creation fails.
>
> Signed-off-by: Hongfu Li <[email protected]>

Reviewed-by: Kevin Brodsky <[email protected]>

> ---
>  tools/testing/selftests/mm/pkey_sighandler_tests.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c 
> b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> index d185d3da26cf..f30c9965a561 100644
> --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
> +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> @@ -224,7 +224,8 @@ static void test_sigsegv_handler_with_pkey0_disabled(void)
>       pthread_attr_init(&attr);
>       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
>  
> -     pthread_create(&thr, &attr, thread_segv_with_pkey0_disabled, NULL);
> +     ret = pthread_create(&thr, &attr, thread_segv_with_pkey0_disabled, 
> NULL);
> +     pkey_assert(ret == 0);
>  
>       pthread_mutex_lock(&mutex);
>       while (siginfo.si_signo == 0)
> @@ -263,7 +264,8 @@ static void test_sigsegv_handler_cannot_access_stack(void)
>       pthread_attr_init(&attr);
>       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
>  
> -     pthread_create(&thr, &attr, thread_segv_pkuerr_stack, NULL);
> +     ret = pthread_create(&thr, &attr, thread_segv_pkuerr_stack, NULL);
> +     pkey_assert(ret == 0);
>  
>       pthread_mutex_lock(&mutex);
>       while (siginfo.si_signo == 0)

Reply via email to