From: "Robert Święcki" <robert@swiecki.net>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: GLIBC Devel <libc-alpha@sourceware.org>,
Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: Caching of PID/TID after fork
Date: Fri, 07 Oct 2016 21:23:00 -0000 [thread overview]
Message-ID: <CAP145phqU29-vMNkS6zzWRJn4L_F9+zHQkybiirQndBcxJGp8g@mail.gmail.com> (raw)
In-Reply-To: <87y4202blm.fsf@mid.deneb.enyo.de>
HI all,
> The stack check seems just error-prone one and I see it might be
> justifiable to remove it. I am not sure how we should act on
> semantic change for Linux-only syscall, so it might require to
> add compatibility symbol I would try to avoid it.
I was thinking that maybe the following would work (in asm), without
the need to introduce additional files / codepaths.
ENTRY(clone):
check_for_newsp_nonnull
check_for_fn_nonnull
ENTRY(__clone3):
clone_logic_wo_checks
END(__clone3)
END(clone)
EXPORT(clone)
EXPORT(__clone3)
But, all in all, I agree that doing it (TM) right way (with support
for pthread_at_fork) might be a better choice.
>
> > Thefore I'd like to ask for one of the following solutions:
> >
> > 1. Don't cache PID/TID
> >
> > 2. Provide some kind of symbol, which would force for TID/PID to be
> > reloaded in glibc.
>
> I think we need a different design.
>
> For example, when you clone a process, you really want that all
> cryptographic random number generators are reinitialized. Making this
> depend on getpid does not really work, so we need a more general
> solution.
Agreed.
>
> The other question I have is whether we talk about clone-as-fork
> exclusively. Introducing a new thread into the process on which
> non-free-standing code can run using clone is a different matter
> altogether.
To my knowledge, in the vast majority of cases (or even, in all
cases), where the TID/PID caching problem surfaced, it could have been
solved by fork_with_flags() indeed.
Though, one useful feature which could be potentially useful for some
porjects would be to create a detached process (for which the kernel
doesn't send termination signal - usually SIGCHLD - to the parent
process). And this cannot be solved by ORing custom flags with fork
ones, because SIGCHLD is already there. But, it's just a guess.
--
Robert Święcki
next prev parent reply other threads:[~2016-10-07 21:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-06 16:13 Robert Święcki
2016-10-06 16:34 ` Paul Pluzhnikov
2016-10-06 17:03 ` Robert Święcki
2016-10-06 18:32 ` Adhemerval Zanella
2016-10-06 17:26 ` Rich Felker
2016-10-06 17:42 ` Robert Święcki
2016-10-06 18:05 ` Rich Felker
2016-10-06 18:26 ` Robert Święcki
2016-10-06 21:35 ` Robert Święcki
2016-10-07 0:42 ` Zack Weinberg
2016-10-07 0:43 ` Zack Weinberg
2016-10-07 14:44 ` Robert Święcki
2016-10-07 18:20 ` Adhemerval Zanella
2016-10-07 18:30 ` Adhemerval Zanella
2016-10-07 19:38 ` Florian Weimer
2016-10-07 21:23 ` Robert Święcki [this message]
2016-10-09 10:05 ` Florian Weimer
2016-10-09 14:19 ` Robert Święcki
2016-10-10 18:03 ` Adhemerval Zanella
2016-11-04 15:14 ` Florian Weimer
2016-11-04 16:03 ` Adhemerval Zanella
2016-11-07 16:04 ` Florian Weimer
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=CAP145phqU29-vMNkS6zzWRJn4L_F9+zHQkybiirQndBcxJGp8g@mail.gmail.com \
--to=robert@swiecki.net \
--cc=adhemerval.zanella@linaro.org \
--cc=fw@deneb.enyo.de \
--cc=libc-alpha@sourceware.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).