Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
@ 2026-05-09  8:26 Wei Gao via ltp
  2026-05-12  8:08 ` [LTP] " linuxtestproject.agent
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Wei Gao via ltp @ 2026-05-09  8:26 UTC (permalink / raw)
  To: ltp

Latest test in our openqa setup (Linux 7.1-rc2, Glibc 2.43) show following errors:
- pthread_detach_4-2: Test FAILED: Incorrect return code: 0 instead of ESRCH
- pthread_join_6-2: Test FAILED: Return code should be ESRCH, but is: 0 instead.

These are caused by glibc commit 5da15b15adab661c80e373b6af89be0b5fa5b3ad
("nptl: Do not use pthread set_tid_address as state synchronization (BZ #19951)").

The new glibc logic removed the explicit validation of thread handles that
previously returned ESRCH:

--- a/nptl/pthread_detach.c
-  if (INVALID_NOT_TERMINATED_TD_P (pd))
-    return ESRCH;

--- a/nptl/pthread_join_common.c
-  if (INVALID_NOT_TERMINATED_TD_P (pd))
-    return ESRCH;
-

Update the tests to allow both return codes.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 .../conformance/interfaces/pthread_detach/4-2.c             | 6 +++---
 .../conformance/interfaces/pthread_join/6-2.c               | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
index a6dc83efd..1e7b84117 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
@@ -18,7 +18,7 @@
  * 1. Create a thread.
  * 2.Wait 'till the thread exits.
  * 3.Try and detach this thread.
- * 4.Check the return value and make sure it is ESRCH
+ * 4.Check the return value and make sure it is ESRCH or 0
  *
  */
 
@@ -59,9 +59,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 	ret = pthread_detach(new_th);
 
 	/* Check return value of pthread_detach() */
-	if (ret != ESRCH) {
+	if (ret != ESRCH && ret != 0) {
 		printf
-		    ("Test FAILED: Incorrect return code: %d instead of ESRCH\n",
+		    ("Test FAILED: Incorrect return code: %d instead of ESRCH or 0\n",
 		     ret);
 		return PTS_FAIL;
 
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
index bd7e295d6..4052a55e2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
@@ -61,11 +61,11 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 
 	/*
 	 * Now that the thread has returned, try to join it again.
-	 * It should give the error code of ESRCH.
+	 * It should give the error code of ESRCH or 0.
 	 */
 	ret = pthread_join(new_th, NULL);
-	if (ret != ESRCH) {
-		printf("Test FAILED: Return code should be ESRCH, but is: "
+	if (ret != ESRCH && ret != 0) {
+		printf("Test FAILED: Return code should be ESRCH or 0, but is: "
 		       "%d instead.\n", ret);
 		return PTS_FAIL;
 	}
-- 
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-05-12 11:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09  8:26 [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread Wei Gao via ltp
2026-05-12  8:08 ` [LTP] " linuxtestproject.agent
2026-05-12  8:18   ` Andrea Cervesato via ltp
2026-05-12  9:21     ` Wei Gao via ltp
2026-05-12  9:30       ` Andrea Cervesato via ltp
2026-05-12  8:18 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
2026-05-12  9:31 ` Andrea Cervesato via ltp
2026-05-12 11:10 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox