All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Gao via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
Date: Sat,  9 May 2026 08:26:47 +0000	[thread overview]
Message-ID: <20260509082649.8533-1-wegao@suse.com> (raw)

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

             reply	other threads:[~2026-05-09  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  8:26 Wei Gao via ltp [this message]
2026-05-12  8:08 ` [LTP] OpenPOSIX: Allow 0 return value when detaching or joining joined thread 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260509082649.8533-1-wegao@suse.com \
    --to=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.