* [PATCH v2 0/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask
@ 2024-11-08 14:50 Ilya Leoshkevich
2024-11-08 14:50 ` [PATCH v2 1/1] " Ilya Leoshkevich
2024-11-12 15:39 ` [PATCH v2 0/1] " Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2024-11-08 14:50 UTC (permalink / raw)
To: Alex Bennée, Richard Henderson; +Cc: qemu-devel, Ilya Leoshkevich
v1: https://lore.kernel.org/qemu-devel/20241017125811.447961-1-iii@linux.ibm.com/
v1 -> v2: Drop patch 1, since it's merged.
Add -pthread to the test (Richard).
Hi,
I noticed that while the sigreturn fix was merged, the test wasn't.
Richard noticed that -pthread was missing, so I'm resending the test
with this issue fixed.
Best regards,
Ilya
Ilya Leoshkevich (1):
tests/tcg: Test that sigreturn() does not corrupt the signal mask
tests/tcg/multiarch/Makefile.target | 3 ++
tests/tcg/multiarch/sigreturn-sigmask.c | 51 +++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 tests/tcg/multiarch/sigreturn-sigmask.c
--
2.47.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask 2024-11-08 14:50 [PATCH v2 0/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask Ilya Leoshkevich @ 2024-11-08 14:50 ` Ilya Leoshkevich 2024-11-12 15:39 ` [PATCH v2 0/1] " Richard Henderson 1 sibling, 0 replies; 3+ messages in thread From: Ilya Leoshkevich @ 2024-11-08 14:50 UTC (permalink / raw) To: Alex Bennée, Richard Henderson; +Cc: qemu-devel, Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- tests/tcg/multiarch/Makefile.target | 3 ++ tests/tcg/multiarch/sigreturn-sigmask.c | 51 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/tcg/multiarch/sigreturn-sigmask.c diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 78b83d5575a..18d3cf4ae00 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -42,6 +42,9 @@ munmap-pthread: LDFLAGS+=-pthread vma-pthread: CFLAGS+=-pthread vma-pthread: LDFLAGS+=-pthread +sigreturn-sigmask: CFLAGS+=-pthread +sigreturn-sigmask: LDFLAGS+=-pthread + # The vma-pthread seems very sensitive on gitlab and we currently # don't know if its exposing a real bug or the test is flaky. ifneq ($(GITLAB_CI),) diff --git a/tests/tcg/multiarch/sigreturn-sigmask.c b/tests/tcg/multiarch/sigreturn-sigmask.c new file mode 100644 index 00000000000..e6cc904898d --- /dev/null +++ b/tests/tcg/multiarch/sigreturn-sigmask.c @@ -0,0 +1,51 @@ +/* + * Test that sigreturn() does not corrupt the signal mask. + * Block SIGUSR2 and handle SIGUSR1. + * Then sigwait() SIGUSR2, which relies on it remaining blocked. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include <assert.h> +#include <pthread.h> +#include <signal.h> +#include <stdlib.h> +#include <unistd.h> + +int seen_sig = -1; + +static void signal_func(int sig) +{ + seen_sig = sig; +} + +static void *thread_func(void *arg) +{ + kill(getpid(), SIGUSR2); + return NULL; +} + +int main(void) +{ + struct sigaction act = { + .sa_handler = signal_func, + }; + pthread_t thread; + sigset_t set; + int sig; + + assert(sigaction(SIGUSR1, &act, NULL) == 0); + + assert(sigemptyset(&set) == 0); + assert(sigaddset(&set, SIGUSR2) == 0); + assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0); + + kill(getpid(), SIGUSR1); + assert(seen_sig == SIGUSR1); + + assert(pthread_create(&thread, NULL, thread_func, NULL) == 0); + assert(sigwait(&set, &sig) == 0); + assert(sig == SIGUSR2); + assert(pthread_join(thread, NULL) == 0); + + return EXIT_SUCCESS; +} -- 2.47.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 0/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask 2024-11-08 14:50 [PATCH v2 0/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask Ilya Leoshkevich 2024-11-08 14:50 ` [PATCH v2 1/1] " Ilya Leoshkevich @ 2024-11-12 15:39 ` Richard Henderson 1 sibling, 0 replies; 3+ messages in thread From: Richard Henderson @ 2024-11-12 15:39 UTC (permalink / raw) To: Ilya Leoshkevich, Alex Bennée; +Cc: qemu-devel On 11/8/24 06:50, Ilya Leoshkevich wrote: > v1: https://lore.kernel.org/qemu-devel/20241017125811.447961-1-iii@linux.ibm.com/ > v1 -> v2: Drop patch 1, since it's merged. > Add -pthread to the test (Richard). > > Hi, > > I noticed that while the sigreturn fix was merged, the test wasn't. > Richard noticed that -pthread was missing, so I'm resending the test > with this issue fixed. > > Best regards, > Ilya > > > > Ilya Leoshkevich (1): > tests/tcg: Test that sigreturn() does not corrupt the signal mask > > tests/tcg/multiarch/Makefile.target | 3 ++ > tests/tcg/multiarch/sigreturn-sigmask.c | 51 +++++++++++++++++++++++++ > 2 files changed, 54 insertions(+) > create mode 100644 tests/tcg/multiarch/sigreturn-sigmask.c > Queued, thanks. r~ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-12 15:40 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-08 14:50 [PATCH v2 0/1] tests/tcg: Test that sigreturn() does not corrupt the signal mask Ilya Leoshkevich 2024-11-08 14:50 ` [PATCH v2 1/1] " Ilya Leoshkevich 2024-11-12 15:39 ` [PATCH v2 0/1] " Richard Henderson
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.