selftests/mm: add missing pthread_create() return checks in pkey tests

Add missing pthread_create() return checks in pkey sighandler tests to
avoid hanging in pthread_cond_wait() when thread creation fails.

Link: https://lore.kernel.org/20260706081600.3570203-6-lihongfu@kylinos.cn
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Tested-by: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Keith Lucas <keith.lucas@oracle.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Ross Zwisler <zwisler@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Yury Khrustalev <yury.khrustalev@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Hongfu Li
2026-07-06 16:15:59 +08:00
committed by Andrew Morton
parent 654b88fe7d
commit 5a8e068339

View File

@@ -220,7 +220,11 @@ 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);
if (ret) {
errno = ret;
pkey_assert(0);
}
pthread_mutex_lock(&mutex);
while (siginfo.si_signo == 0)
@@ -259,7 +263,11 @@ 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);
if (ret) {
errno = ret;
pkey_assert(0);
}
pthread_mutex_lock(&mutex);
while (siginfo.si_signo == 0)