summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorHongfu Li <lihongfu@kylinos.cn>2026-07-06 16:15:59 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-07-08 22:54:30 -0700
commit75827a59e57381ecd0b268570775758e51762036 (patch)
treedd341b258a9799a75ea7297be9ba63eeaf57b458 /tools/testing
parent26250e26c7edb8411bbd3b2af3c749f9a621c823 (diff)
downloadlinux-next-75827a59e57381ecd0b268570775758e51762036.tar.gz
linux-next-75827a59e57381ecd0b268570775758e51762036.zip
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>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/mm/pkey_sighandler_tests.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index 8f98e6d9349f..cbc24d6cf770 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -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)