From: Denys Vlasenko <dvlasenk@redhat.com>
To: dash@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: Looking at "int vforked" in signal handler is racy
Date: Sat, 9 Aug 2025 15:42:13 +0200 [thread overview]
Message-ID: <38e17655-0aee-6bc2-bad9-7a209fa6d51e@redhat.com> (raw)
In-Reply-To: <dadfa485-b5ee-30d7-7154-362cf2eb04cd@redhat.com>
> I see this solution:
>
> vfork_parent_pid = getpid();
> have_vfork_sibling = 1;
> pid = vfork();
> if (!pid) { child ops; NORETURN; }
> have_vfork_sibling = 0;
>
> void
> onsig(int signo)
> {
> if (after_vfork && getpid() != vfork_parent_pid)
^^^^^^^^^^^s/after_vfork/have_vfork_sibling/
> /* We are vfork child, DO NOT MODIFY ANY VARIABLES! */
> return;
next prev parent reply other threads:[~2025-08-09 13:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-09 13:29 Looking at "int vforked" in signal handler is racy Denys Vlasenko
2025-08-09 13:42 ` Denys Vlasenko [this message]
2025-08-09 13:52 ` Harald van Dijk
2025-08-10 19:33 ` Denys Vlasenko
2025-08-10 22:20 ` Harald van Dijk
2025-08-11 5:00 ` Herbert Xu
2025-08-11 12:58 ` Harald van Dijk
2025-08-22 1:32 ` Harald van Dijk
2025-08-24 2:39 ` Herbert Xu
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=38e17655-0aee-6bc2-bad9-7a209fa6d51e@redhat.com \
--to=dvlasenk@redhat.com \
--cc=dash@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
/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