All of lore.kernel.org
 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

* Re: [LTP] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  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 ` linuxtestproject.agent
  2026-05-12  8:18   ` Andrea Cervesato via ltp
  2026-05-12  8:18 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: linuxtestproject.agent @ 2026-05-12  8:08 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Hi Wei,

On Sat, 09 May 2026 08:26:47 +0000, Wei Gao wrote:
> OpenPOSIX: Allow 0 return value when detaching or joining joined thread

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

The motivation is clear and the fix looks correct — accepting 0 in addition
to ESRCH matches the new glibc behavior.

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

The commit message is missing a Signed-off-by: tag. Please add:

  Signed-off-by: Wei Gao <wegao@suse.com>

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25721673051

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

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

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

* Re: [LTP] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-12  8:18 UTC (permalink / raw)
  To: linuxtestproject.agent; +Cc: ltp

Hi Wei,

if it's ok for you, I can merge it with Signed-off tag.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

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

* Re: [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  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:31 ` Andrea Cervesato via ltp
  2026-05-12 11:10 ` Cyril Hrubis
  3 siblings, 0 replies; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-12  8:18 UTC (permalink / raw)
  To: Wei Gao via ltp; +Cc: ltp

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

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

* Re: [LTP] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Wei Gao via ltp @ 2026-05-12  9:21 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp, linuxtestproject.agent

On Tue, May 12, 2026 at 08:18:21AM +0000, Andrea Cervesato wrote:
> Hi Wei,
> 
> if it's ok for you, I can merge it with Signed-off tag.
My patch has Signed-off, i have no idea why AI can't find it :)
> 
> Regards,
> --
> Andrea Cervesato
> SUSE QE Automation Engineer Linux
> andrea.cervesato@suse.com

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

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

* Re: [LTP] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  2026-05-12  9:21     ` Wei Gao via ltp
@ 2026-05-12  9:30       ` Andrea Cervesato via ltp
  0 siblings, 0 replies; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-12  9:30 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp, linuxtestproject.agent

Hi Wei,

> On Tue, May 12, 2026 at 08:18:21AM +0000, Andrea Cervesato wrote:
> > Hi Wei,
> > 
> > if it's ok for you, I can merge it with Signed-off tag.
> My patch has Signed-off, i have no idea why AI can't find it :)
> > 
> > Regards,
> > --
> > Andrea Cervesato
> > SUSE QE Automation Engineer Linux
> > andrea.cervesato@suse.com

--- 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;
-

Everything that is after --- is threated as a patch comment
by the `git am` command, as well as b4. So after applying the
patch, agent correct seen SOB tag missing nad reported it in
the review.

I will remove this comment in the patch before merge.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

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

* Re: [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  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 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
@ 2026-05-12  9:31 ` Andrea Cervesato via ltp
  2026-05-12 11:10 ` Cyril Hrubis
  3 siblings, 0 replies; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-12  9:31 UTC (permalink / raw)
  To: Wei Gao via ltp; +Cc: ltp

Merged, Thanks!

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

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

* Re: [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread
  2026-05-09  8:26 [LTP] [PATCH v1] OpenPOSIX: Allow 0 return value when detaching or joining joined thread Wei Gao via ltp
                   ` (2 preceding siblings ...)
  2026-05-12  9:31 ` Andrea Cervesato via ltp
@ 2026-05-12 11:10 ` Cyril Hrubis
  3 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-05-12 11:10 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Hi!
> 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;

Technically since this is open posix testsuite we should PTS_UNTESTED on
0 since we were not able to trigger the error since the implementation
does not implement the optional behavior.

Something as:

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 1e7b84117..fc7a6e9c9 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
@@ -58,8 +58,13 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
        /* Detach the non-existant thread. */
        ret = pthread_detach(new_th);

+       if (ret == 0) {
+               printf("Test UNTESTED: Implementation does not return ESCHR\n");
+               return PTS_UNTESTED;
+       }
+
        /* Check return value of pthread_detach() */
-       if (ret != ESRCH && ret != 0) {
+       if (ret != ESRCH) {
                printf
                    ("Test FAILED: Incorrect return code: %d instead of ESRCH or 0\n",
                     ret);


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
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 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.