Re: [PATCH v8] pidfd: add ioctl to retrieve pid info

From: Luca Boccassi
Date: Tue Oct 08 2024 - 08:12:58 EST


On Tue, 8 Oct 2024 at 13:10, Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> On Tue, Oct 08, 2024 at 10:07:18AM GMT, luca.boccassi@xxxxxxxxx wrote:
> > From: Luca Boccassi <luca.boccassi@xxxxxxxxx>
> >
> > A common pattern when using pid fds is having to get information
> > about the process, which currently requires /proc being mounted,
> > resolving the fd to a pid, and then do manual string parsing of
> > /proc/N/status and friends. This needs to be reimplemented over
> > and over in all userspace projects (e.g.: I have reimplemented
> > resolving in systemd, dbus, dbus-daemon, polkit so far), and
> > requires additional care in checking that the fd is still valid
> > after having parsed the data, to avoid races.
> >
> > Having a programmatic API that can be used directly removes all
> > these requirements, including having /proc mounted.
> >
> > As discussed at LPC24, add an ioctl with an extensible struct
> > so that more parameters can be added later if needed. Start with
> > returning pid/tgid/ppid and creds unconditionally, and cgroupid
> > optionally.
> >
> > Signed-off-by: Luca Boccassi <luca.boccassi@xxxxxxxxx>
> > ---
>
> I think Josh's point about dropping result_mask is fair. I can do that
> when I apply though.

I can quickly test and send v9 dropping result_mask, not a problem