From: Dave Martin <Dave.Martin@arm.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
linux-man@vger.kernel.org
Subject: Re: sigaction.2: clarification for SA_NODEFER needed
Date: Mon, 16 Nov 2020 13:29:20 +0000 [thread overview]
Message-ID: <20201116132920.GX6882@arm.com> (raw)
In-Reply-To: <C98DCC3D-49A0-4B02-943A-AA6F2622F66A@gmx.de>
On Thu, Nov 12, 2020 at 10:04:08PM +0100, Heinrich Schuchardt wrote:
> Am 12. November 2020 22:01:58 MEZ schrieb "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>:
> >> Is there a function to change the signal mask without leaving the
> >handler?
> >
> >sigprocmask(2).
>
> You might want to add a link to the function in the note section.
Actually, this is best avoided IMHO:
The behaviour of sigprocmask() is unspecified in multithreaded programs,
while pthread_sigmask() is not specified to be safe in signal handlers.
(Yay, POSIX.)
For these reasons, execve()'ing directly from a signal handler is not a
great idea. It would probably be better to escape from the signal
handler with siglongjmp() or setcontext(), with the target sigjmp_buf or
ucontext previously set up do the execve().
With SA_SIGINFO, you can also update uc->uc_sigmask inside the signal
handler if you want to change the signal mask on return. But that's
awkward to do portably, since sigaddset() and sigdelset() are not
specified to be safe in signal handlers either.
Cheers
---Dave
next prev parent reply other threads:[~2020-11-16 13:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 0:42 sigaction.2: clarification for SA_NODEFER needed Heinrich Schuchardt
2020-11-12 15:37 ` Michael Kerrisk (man-pages)
2020-11-12 16:25 ` Heinrich Schuchardt
2020-11-12 20:45 ` Michael Kerrisk (man-pages)
2020-11-12 20:57 ` Heinrich Schuchardt
2020-11-12 21:01 ` Michael Kerrisk (man-pages)
2020-11-12 21:04 ` Heinrich Schuchardt
2020-11-12 21:17 ` Michael Kerrisk (man-pages)
2020-11-16 13:29 ` Dave Martin [this message]
2020-11-16 13:21 ` Dave Martin
2020-11-17 10:46 ` Michael Kerrisk (man-pages)
2020-11-17 12:05 ` Dave Martin
2020-11-17 17:09 ` Michael Kerrisk (man-pages)
2020-11-17 18:40 ` Dave Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201116132920.GX6882@arm.com \
--to=dave.martin@arm.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).