* [LTP] [PATCH 1/2] openposix: mq_close/2-1: Use a valid signal number for mq_notify()
2026-10-18 16:01 [LTP] [PATCH 0/2] openposix: mq_close/2-1: Fix failure on v7.3+ Avinesh Kumar via ltp
@ 2026-10-18 16:01 ` Avinesh Kumar via ltp
2026-10-18 17:54 ` [LTP] " linuxtestproject.agent
2026-10-20 10:10 ` [LTP] [PATCH 1/2] " Cyril Hrubis
2026-10-18 16:01 ` [LTP] [PATCH 2/2] openposix: mq_close/2-1: Initialize sigev_signo and check for EBUSY Avinesh Kumar via ltp
1 sibling, 2 replies; 6+ messages in thread
From: Avinesh Kumar via ltp @ 2026-10-18 16:01 UTC (permalink / raw)
To: ltp
From: Avinesh Kumar <avinesh.kumar@suse.com>
Linux commit 1184f5e82009 ("mqueue: reject mq_notify with signo 0")
in v7.3-rc1, makes mq_notify() with SIGEV_SIGNAL fail with EINVAL
if sigev_signo is 0.
In mq_close/2-1 test, the child registers its notification with signo 0
after the parent's mq_close(), so the call is now rejected before the
queue state is checked and the test fails on v7.3+.
Use SIGUSR1 as a valid signal.
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
.../open_posix_testsuite/conformance/interfaces/mq_close/2-1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
index 6e704158a575..971278aee730 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
@@ -193,7 +193,7 @@ static int child_process(char *qname, int read_pipe, int write_pipe)
}
// try notify after parent closed queue - should succeed
se.sigev_notify = SIGEV_SIGNAL;
- se.sigev_signo = 0;
+ se.sigev_signo = SIGUSR1;
rval = mq_notify(queue, &se);
// send 'd' for success and 'e' for failure
--
2.56.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread* [LTP] [PATCH 2/2] openposix: mq_close/2-1: Initialize sigev_signo and check for EBUSY
2026-10-18 16:01 [LTP] [PATCH 0/2] openposix: mq_close/2-1: Fix failure on v7.3+ Avinesh Kumar via ltp
2026-10-18 16:01 ` [LTP] [PATCH 1/2] openposix: mq_close/2-1: Use a valid signal number for mq_notify() Avinesh Kumar via ltp
@ 2026-10-18 16:01 ` Avinesh Kumar via ltp
2026-10-20 10:22 ` Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Avinesh Kumar via ltp @ 2026-10-18 16:01 UTC (permalink / raw)
To: ltp
From: Avinesh Kumar <avinesh.kumar@suse.com>
The first mq_notify() call in the child is expected to fail with EBUSY,
because the parent still has a notification registered on the queue.
But sigev_signo is never set for this call, so the kernel gets whatever
is left on the stack. That is often 0, depending on compiler flags
and stack layout.
This used to be harmless, since do_mq_notify() accepted signo 0 and the
call reached the EBUSY check. Since Linux commit 1184f5e82009 ("mqueue:
reject mq_notify with signo 0"), merged in v7.3-rc1, it fails with
EINVAL before the queue state is checked. The test only checks that the
call failed, not why, so it still passes without exercising the EBUSY
case. Trace on v7.3+ with the previous patch (which fixed the child's
second mq_notify() call) applied:
# strace -f -e trace=mq_notify ./mq_close_2-1.run-test
strace: Process 32289 attached
[pid 32288] mq_notify(4, {sigev_signo=SIGUSR1, sigev_notify=SIGEV_SIGNAL}) = 0
[pid 32289] mq_notify(3, {sigev_signo=0, sigev_notify=SIGEV_SIGNAL}) = -1 EINVAL (Invalid argument)
[pid 32289] mq_notify(3, {sigev_signo=SIGUSR1, sigev_notify=SIGEV_SIGNAL}) = 0
Test PASSED
[pid 32289] +++ exited with 0 +++
Set sigev_signo to SIGUSR1 and verify the call fails with EBUSY, so an
unexpected errno is reported as failure instead of passing silently:
# strace -f -e trace=mq_notify ./mq_close_2-1.run-test
strace: Process 32535 attached
[pid 32534] mq_notify(4, {sigev_signo=SIGUSR1, sigev_notify=SIGEV_SIGNAL}) = 0
[pid 32535] mq_notify(3, {sigev_signo=SIGUSR1, sigev_notify=SIGEV_SIGNAL}) = -1 EBUSY (Device or resource busy)
[pid 32535] mq_notify(3, {sigev_signo=SIGUSR1, sigev_notify=SIGEV_SIGNAL}) = 0
Test PASSED
[pid 32535] +++ exited with 0 +++
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
.../conformance/interfaces/mq_close/2-1.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
index 971278aee730..48f80a1ee430 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
@@ -175,12 +175,18 @@ static int child_process(char *qname, int read_pipe, int write_pipe)
if (queue == (mqd_t) - 1) {
return PTS_UNRESOLVED;
}
- // try notify while parent still has queue open - should fail
+ // try notify while parent still has queue open - should fail with EBUSY
se.sigev_notify = SIGEV_SIGNAL;
+ se.sigev_signo = SIGUSR1;
if (!mq_notify(queue, &se)) {
puts(ERROR_PREFIX "mq_notify (2): " "should have failed");
return PTS_UNRESOLVED;
}
+ if (errno != EBUSY) {
+ perror(ERROR_PREFIX "mq_notify (2): expected EBUSY");
+ return PTS_UNRESOLVED;
+ }
+
// send 'b' - signal parent to close queue
rval = send_receive(read_pipe, write_pipe, 'b', &reply);
if (rval) {
--
2.56.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread