* [LTP] [PATCH] open_posix: remove pthread_kill/6-1
@ 2021-10-06 13:31 Jan Stancek
2021-10-06 14:31 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2021-10-06 13:31 UTC (permalink / raw)
To: ltp
Test fails on recent glibc (glibc-2.34).
Per https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_02:
If an application attempts to use a thread ID whose lifetime has ended,
the behavior is undefined."
In some scenarios leading to crash. Example from Florian Weimer [1]:
Invoking pthread_kill with a thread ID whose lifetime has ended is
undefined behavior, so this test is invalid. For example, if you run
this test with GLIBC_TUNABLES=glibc.pthread.stack_cache_size=0,
the pthread_kill call crashes because without a stack cache,
the underlying thread control block is unmapped as part of pthread_join."
[1] https://gitlab.com/cki-project/kernel-tests/-/issues/768
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../conformance/interfaces/pthread_kill/6-1.c | 62 -------------------
.../interfaces/pthread_kill/assertions.xml | 4 --
.../interfaces/pthread_kill/coverage.txt | 1 -
3 files changed, 67 deletions(-)
delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
deleted file mode 100644
index a462ba8e04ce..000000000000
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
- * Created by: salwan.searty REMOVE-THIS AT intel DOT com
- * This file is licensed under the GPL license. For the full content
- * of this license, see the COPYING file at the top level of this
- * source tree.
- *
- * Test that the pthread_kill() function shall return ESRCH when no
- * thread could be found corresponding to that specified by the given
- * thread ID.
- *
- * NOTE: Cannot find 6-1.c in PTS cvs. So write this one.
- */
-
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include "posixtest.h"
-
-static void *thread_function(void *arg PTS_ATTRIBUTE_UNUSED)
-{
- /* Does nothing */
- pthread_exit(NULL);
-
- /* To please some compilers */
- return NULL;
-}
-
-int main(void)
-{
- pthread_t child_thread;
- pthread_t invalid_tid;
-
- int rc;
-
- rc = pthread_create(&child_thread, NULL, thread_function, NULL);
- if (rc != 0) {
- printf("Error at pthread_create()\n");
- return PTS_UNRESOLVED;
- }
-
- rc = pthread_join(child_thread, NULL);
- if (rc != 0) {
- printf("Error at pthread_join()\n");
- return PTS_UNRESOLVED;
- }
-
- /* Now the child_thread exited, it is an invalid tid */
- memcpy(&invalid_tid, &child_thread, sizeof(pthread_t));
-
- if (pthread_kill(invalid_tid, 0) == ESRCH) {
- printf("pthread_kill() returns ESRCH.\n");
- return PTS_PASS;
- }
-
- printf("Test Fail\n");
- return PTS_FAIL;
-}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
index 2289b9bfbb2e..fa74c312bebb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
@@ -16,10 +16,6 @@
<assertion id="5" tag="ref:XSH6:33594:33595 pt:THR">
No signal shall be sent if the pthread_kill() function fails.
</assertion>
- <assertion id="6" tag="ref:XSH6:33598:33599 pt:THR">
- [ESRCH] No thread could be found corresponding to that specified by
- the given thread ID.
- </assertion>
<assertion id="7" tag="ref:XSH6:33600:33600 pt:THR">
[EINVAL] The value of the sig argument is an invalid or unsupported
signal number.
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
index 03dc3d5a718a..8cfa3d8b6ba3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
@@ -6,6 +6,5 @@ Assertion Status
3 YES
4 IMPLICITLY tested by assertions 6 and 7.
5 IMPLICITLY tested by assertions 6 and 7.
-6 YES
7 YES
8 WON'T test. No way to interrupt the pthread_kill() call.
--
2.27.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] open_posix: remove pthread_kill/6-1
2021-10-06 13:31 [LTP] [PATCH] open_posix: remove pthread_kill/6-1 Jan Stancek
@ 2021-10-06 14:31 ` Cyril Hrubis
2021-10-06 14:58 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2021-10-06 14:31 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp
Hi!
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> index 2289b9bfbb2e..fa74c312bebb 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> @@ -16,10 +16,6 @@
> <assertion id="5" tag="ref:XSH6:33594:33595 pt:THR">
> No signal shall be sent if the pthread_kill() function fails.
> </assertion>
> - <assertion id="6" tag="ref:XSH6:33598:33599 pt:THR">
> - [ESRCH] No thread could be found corresponding to that specified by
> - the given thread ID.
> - </assertion>
> <assertion id="7" tag="ref:XSH6:33600:33600 pt:THR">
> [EINVAL] The value of the sig argument is an invalid or unsupported
> signal number.
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> index 03dc3d5a718a..8cfa3d8b6ba3 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> @@ -6,6 +6,5 @@ Assertion Status
> 3 YES
> 4 IMPLICITLY tested by assertions 6 and 7.
> 5 IMPLICITLY tested by assertions 6 and 7.
> -6 YES
> 7 YES
> 8 WON'T test. No way to interrupt the pthread_kill() call.
Shouldn't we just flip the YES to WON'T test in the coverage?
I'm not sure how to maintain the assertions or coverage files to be
honest.
Otherwise it looks good. The ESRCH return was always a recommendation
and not an requirement.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] open_posix: remove pthread_kill/6-1
2021-10-06 14:31 ` Cyril Hrubis
@ 2021-10-06 14:58 ` Jan Stancek
2021-10-07 6:57 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2021-10-06 14:58 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: LTP List
[-- Attachment #1.1: Type: text/plain, Size: 2162 bytes --]
On Wed, Oct 6, 2021 at 4:31 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> > index 2289b9bfbb2e..fa74c312bebb 100644
> > ---
> a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> > +++
> b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/assertions.xml
> > @@ -16,10 +16,6 @@
> > <assertion id="5" tag="ref:XSH6:33594:33595 pt:THR">
> > No signal shall be sent if the pthread_kill() function fails.
> > </assertion>
> > - <assertion id="6" tag="ref:XSH6:33598:33599 pt:THR">
> > - [ESRCH] No thread could be found corresponding to that specified by
> > - the given thread ID.
> > - </assertion>
> > <assertion id="7" tag="ref:XSH6:33600:33600 pt:THR">
> > [EINVAL] The value of the sig argument is an invalid or unsupported
> > signal number.
> > diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> > index 03dc3d5a718a..8cfa3d8b6ba3 100644
> > ---
> a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> > +++
> b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/coverage.txt
> > @@ -6,6 +6,5 @@ Assertion Status
> > 3 YES
> > 4 IMPLICITLY tested by assertions 6 and 7.
> > 5 IMPLICITLY tested by assertions 6 and 7.
> > -6 YES
> > 7 YES
> > 8 WON'T test. No way to interrupt the pthread_kill() call.
>
>
> Shouldn't we just flip the YES to WON'T test in the coverage?
>
I dropped it because it seemed pointless to keep around wrong assertions.
I don't have strong opinion here, I can change it to WON'T.
>
> I'm not sure how to maintain the assertions or coverage files to be
> honest.
>
> Otherwise it looks good. The ESRCH return was always a recommendation
> and not an requirement.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
>
[-- Attachment #1.2: Type: text/html, Size: 3287 bytes --]
[-- Attachment #2: Type: text/plain, Size: 60 bytes --]
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] open_posix: remove pthread_kill/6-1
2021-10-06 14:58 ` Jan Stancek
@ 2021-10-07 6:57 ` Cyril Hrubis
2021-10-07 14:22 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2021-10-07 6:57 UTC (permalink / raw)
To: Jan Stancek; +Cc: LTP List
Hi!
> > Shouldn't we just flip the YES to WON'T test in the coverage?
> >
>
> I dropped it because it seemed pointless to keep around wrong assertions.
> I don't have strong opinion here, I can change it to WON'T.
Neither do I.
Anyways, feel free to push with either change.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] open_posix: remove pthread_kill/6-1
2021-10-07 6:57 ` Cyril Hrubis
@ 2021-10-07 14:22 ` Jan Stancek
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2021-10-07 14:22 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: LTP List
On Thu, Oct 7, 2021 at 8:56 AM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > > Shouldn't we just flip the YES to WON'T test in the coverage?
> > >
> >
> > I dropped it because it seemed pointless to keep around wrong assertions.
> > I don't have strong opinion here, I can change it to WON'T.
>
> Neither do I.
>
> Anyways, feel free to push with either change.
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Pushed.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-07 14:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-06 13:31 [LTP] [PATCH] open_posix: remove pthread_kill/6-1 Jan Stancek
2021-10-06 14:31 ` Cyril Hrubis
2021-10-06 14:58 ` Jan Stancek
2021-10-07 6:57 ` Cyril Hrubis
2021-10-07 14:22 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox