public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Caching of PID/TID after fork
@ 2016-10-06 16:13 Robert Święcki
  2016-10-06 16:34 ` Paul Pluzhnikov
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Robert Święcki @ 2016-10-06 16:13 UTC (permalink / raw)
  To: libc-alpha

Hi,

This has probably been debated a lot of times in the past, but...

A lot of tool these days create Linux namespaces, using clone(). Using
glibc's clone() is not the best option, because e.g. it requires stack
pointer, (and fails with some error if it's NULL), while Linux kernel
will happily reuse the current SP (no need to write additional code to
deal with that). So, glibc's clone() adds imposed additional
restrictions wrt kernel.

And, after that getpid() will return old PID/TID.

It seems that currently Linux supports getpid() via vsyscall (fast) on
x86/64. Would you consider changing getpid() to be a wrapper to
syscall(__NR_getpid)?

One could say that if somebody uses syscall(__NR_clone) she/he should
be using syscall(__NR_getpid) as well, but in case of software
libraries, which might be preparing namespaces, the caller of the lib
might know nothing about the exact method used to create a new
process.

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.

-- 
Robert Święcki

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-11-07 16:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 16:13 Caching of PID/TID after fork 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
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

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).