Skip to content

pidfd: add pidfd_prepare()

Christian Brauner linux-fsdevel lkml netdev 1 version In review

Get series with b4
b4 am [email protected] change-id 20230327-pidfd-file-api-8b28d68cf0a9

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3pid: add pidfd_prepare()include/linux/pid.h kernel/pid.c+58 -121 reply
2/3fork: use pidfd_prepare()kernel/fork.c+1 -110 replies
3/3fanotify: use pidfd_prepare()fs/notify/fanotify/fanotify_user.c+9 -41 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchJan Kara
1/3R-b
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] pidfd: add pidfd_prepare()

This adds the pidfd_prepare() helper which allows the caller to reserve a pidfd number and allocates a new pidfd file that stashes the provided struct pid.

This will allow us to remove places that either open code this functionality e.g., during copy_process() or that currently call pidfd_create() but then have to call close_fd() because there are still failure points after pidfd_create() has been called.

Other functionality wants to make use of pidfd's as well and they need a pidfd_prepare() internal api as well.

I've tested the fanotify and fork changes via LTP which provides coverage for all the affected codepaths.

---
Christian Brauner (3):
pid: add pidfd_prepare()
fork: use pidfd_prepare()
fanotify: use pidfd_prepare()

 fs/notify/fanotify/fanotify_user.c | 13 ++++---
 include/linux/pid.h                |  1 +
 kernel/fork.c                      | 12 +------
 kernel/pid.c                       | 69 +++++++++++++++++++++++++++++++-------
 4 files changed, 68 insertions(+), 27 deletions(-)

---
base-commit: 197b6b60ae7bc51dd0814953c562833143b292aa
change-id: 20230327-pidfd-file-api-8b28d68cf0a9