public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Robert Święcki" <robert@swiecki.net>
To: Rich Felker <dalias@libc.org>
Cc: GLIBC Devel <libc-alpha@sourceware.org>
Subject: Re: Caching of PID/TID after fork
Date: Thu, 06 Oct 2016 18:26:00 -0000	[thread overview]
Message-ID: <CAP145phG3DL2nFmA32Lu2J_aQEahKT1CoZrNJaGDn76Mov32Ww@mail.gmail.com> (raw)
In-Reply-To: <20161006180514.GP19318@brightrain.aerifal.cx>

>> Thanks Rich, that's an interesting idea. I might use it.
>>
>>
>> Though, IMO, the problem still exist. Some subset of non-trivial
>> projects which are affected by this behavior:
>>
>> AFL - https://lcamtuf.blogspot.com/2014/10/fuzzing-binaries-without-execve.html
>> ("because the library caches the result of getpid() when initializing
>> - and without a way to make it reconsider, PID-dependent calls such as
>> abort() or raise() will go astray. There is also a library wrapper for
>> the clone() call that does update the cached PID - but the wrapper is
>> unwieldy and insists on messing with the process' stack.")
>>
>> LXC/Docker - https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-August/009920.html
>
> Why can't they use the approach I just described?

Admittedly, they probably could... it's just the clone interface is
probably supposed to be used by projects like that (non trivial ones,
depending deeply on kernel interfaces), and it seems that the authors
of those non-trivial tools (possibly, quite experienced in the area of
computer architectures) are somewhat troubled by the current glibc
behavior.

Therefore, maybe there's some opportunity here for glibc to provide
them with an interface which might better suit their needs. In my
opinion, the path that every future developer dealing with this issue
have to take (from analyzing the kernel's __NR_clone implementation to
by-passing glibc wrapper with setjmp/longjmp) might be a bit more
complex than it should.

-- 
Robert Święcki

  reply	other threads:[~2016-10-06 18:26 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 [this message]
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
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=CAP145phG3DL2nFmA32Lu2J_aQEahKT1CoZrNJaGDn76Mov32Ww@mail.gmail.com \
    --to=robert@swiecki.net \
    --cc=dalias@libc.org \
    --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).