https://bugs.kde.org/show_bug.cgi?id=526386
Bug ID: 526386
Summary: sigsuspend() returns and consumes pending SIGCHLD
without running handler.
Classification: Developer tools
Product: valgrind
Version First 3.27 GIT
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 196645
--> https://bugs.kde.org/attachment.cgi?id=196645&action=edit
Program that reproduces the issue.
DESCRIPTION
When SIGCHLD is blocked and a handler is installed, a call to sigsuspend() with
a set that does not include SIGCHLD should only return after a handler is run.
Under valgrind, sigsuspend() can wake up after SIGCHLD is no longer reported as
pending without running an installed handler which shouldn't be possible under
normal POSIX signal semantics.
STEPS TO REPRODUCE
1. Install a handler for SIGCHLD using sigaction(2).
2. Add SIGCHLD to the process mask using sigprocmask(2).
3. Fork a child that exits immediately and wait until SIGCHLD is reported by
sigpending(2).
4. Call sigsuspend(2) with a set that does not include SIGCHLD.
OBSERVED RESULT
$ valgrind --quiet ./test
before sigsuspend: sigchld_pending=1 sigchld_caught=0
after sigsuspend: sigchld_pending=0 sigchld_caught=0
Before calling sigsuspend(), SIGCHLD is pending and the flag set in the handler
is not set.
After calling sigsuspend(), SIGCHLD is no longer pending but the flag set by
the handler is still not set.
EXPECTED RESULT
$ ./test
before sigsuspend: sigchld_pending=1 sigchld_caught=0
after sigsuspend: sigchld_pending=0 sigchld_caught=1
sigsuspend() only returns after the handler is run and the flag is set.
See the attached file 'val_signal_bug.c'
I built it with gcc --std=c23 val_signal_bug.c -o test
Operating System: Fedora Linux 43 (Sway Spin)
Desktop/Window Manager: Sway
KDE Plasma Version: N/A
KDE Frameworks Version: N/A
--
You are receiving this mail because:
You are watching all bug changes.