This is the mail archive of the
mailing list for the glibc project.
Re: [RFC v3 03/23] sysdeps/wait: Use waitid if avaliable
- From: Arnd Bergmann <arnd at arndb dot de>
- To: "Eric W. Biederman" <ebiederm at xmission dot com>
- Cc: Rich Felker <dalias at libc dot org>, Alistair Francis <alistair dot francis at wdc dot com>, GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Palmer Dabbelt <palmer at sifive dot com>, macro at wdc dot com, Zong Li <zongbox at gmail dot com>, Alistair Francis <alistair23 at gmail dot com>, Andrew Morton <akpm at linux-foundation dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Al Viro <viro at zeniv dot linux dot org dot uk>, Christian Brauner <christian at brauner dot io>, "H. Peter Anvin" <hpa at zytor dot com>
- Date: Sun, 21 Jul 2019 19:05:46 +0200
- Subject: Re: [RFC v3 03/23] sysdeps/wait: Use waitid if avaliable
- References: <email@example.com> <firstname.lastname@example.org> <20190721040310.GA3283@brightrain.aerifal.cx> <CAK8P3a0bhS_d1SMyLQO_LDNvdgR+MKXmoESxWkrcz22mvjKcuw@mail.gmail.com> <email@example.com> <CAK8P3a3wgavtarKxSYJGL0ME9KRZ8UsUAZw+Y5J8WpG1GQfirstname.lastname@example.org> <email@example.com>
On Sun, Jul 21, 2019 at 5:45 PM Eric W. Biederman <firstname.lastname@example.org> wrote:
> Arnd Bergmann <email@example.com> writes:
> > On Sun, Jul 21, 2019 at 2:15 PM Eric W. Biederman <firstname.lastname@example.org> wrote:
> >> Arnd Bergmann <email@example.com> writes:
> >> > On Sun, Jul 21, 2019 at 6:03 AM Rich Felker <firstname.lastname@example.org> wrote:
> >> >> On Tue, Jul 16, 2019 at 05:08:48PM -0700, Alistair Francis wrote:
> > - The race that Rich pointed out
> > - The lack of pidfd support
> > - The usage of a 32-bit timeval structure that is incompatible with
> > the libc definition on rv32 and other 32-bit architectures with
> > a y2038-safe libc (there is no y2038 overflow in rusage itself, but
> > it requires an ugly wrapper to convert the structure)
> > - The lack of nanosecond resolution in rusage that someone asked for
> > - When we last talked about it, there was some debate over replacing
> > siginfo_t with a different structure.
> > We don't have to address each one of those in a single new syscall
> > (or even at all), but addressing them one at a time would risk adding
> > even more system calls to do essentially just one thing that already
> > has at least five versions at the libc level (wait, waitpid, wait3, wait4
> > and waitid).
> For the particular issue of 32bit riscv needing a working wait4 I see
> one of two possibilities.
> We either add P_PROCESS_PGID to the kernel's waitid or we add wait4.
> I am leaning towards P_PROCESS_PGID as this is the tiny little bit
> needed to make the kernel's waitid the one call that combines them all,
> that it already tries to be. Plus P_PROCESS_PGID or the equivalent in
> the kernel internal version is needed if we choose to have wait4 handle
> the process group id changing while wait4 is running.
Yes, that sounds good to me, both as a short-term and as a long-term
solution for the race, on all architectures. It would help if we could
have some extra review on the wait4() and waitpid() implementation
around waitid(). I first implemented this in my prototype for a y2038-safe
musl port, and Alistair write a corresponding version for glibc.
I did make sure that it passes LTP (and that found a number of bugs
in my first attempt), but it would still be good to know that the P_PGID
issue is the only problem in the underlying system call, aside from
any remaining bugs in the wrapper implementation.