diff options
author | Oleg Nesterov <oleg@redhat.com> | 2024-01-25 17:17:34 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-02-02 13:12:28 +0100 |
commit | cdefbf2324ceda662e2667aa2f44e8b9de3d780f (patch) | |
tree | a5b9cff87110f6d621da9f87d2fe759ad02c2d33 /include/linux/pid.h | |
parent | b639585e71e63008373d3a9fd060b87315fe7ea8 (diff) |
pidfd: cleanup the usage of __pidfd_prepare's flags
- make pidfd_create() static.
- Don't pass O_RDWR | O_CLOEXEC to __pidfd_prepare() in copy_process(),
__pidfd_prepare() adds these flags unconditionally.
- Kill the flags check in __pidfd_prepare(). sys_pidfd_open() checks the
flags itself, all other users of pidfd_prepare() pass flags = 0.
If we need a sanity check for those other in kernel users then
WARN_ON_ONCE(flags & ~PIDFD_NONBLOCK) makes more sense.
- Don't pass O_RDWR to get_unused_fd_flags(), it ignores everything except
O_CLOEXEC.
- Don't pass O_CLOEXEC to anon_inode_getfile(), it ignores everything except
O_ACCMODE | O_NONBLOCK.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/r/20240125161734.GA778@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r-- | include/linux/pid.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h index 395cacce1179..e6a041cb8bac 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -73,7 +73,6 @@ struct file; extern struct pid *pidfd_pid(const struct file *file); struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags); struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags); -int pidfd_create(struct pid *pid, unsigned int flags); int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret); static inline struct pid *get_pid(struct pid *pid) |