mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
pidfs: support FS_IOC_GETVERSION
This will allow 32 bit userspace to detect when a given inode number has been recycled and also to construct a unique 64 bit identifier. Link: https://lore.kernel.org/r/20241129-work-pidfs-v2-3-61043d66fbce@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
03c212bf3f
commit
230536ff6b
|
|
@ -271,6 +271,14 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
struct ns_common *ns_common = NULL;
|
||||
struct pid_namespace *pid_ns;
|
||||
|
||||
if (cmd == FS_IOC_GETVERSION) {
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
|
||||
__u32 __user *argp = (__u32 __user *)arg;
|
||||
return put_user(file_inode(file)->i_generation, argp);
|
||||
}
|
||||
|
||||
task = get_pid_task(pid, PIDTYPE_PID);
|
||||
if (!task)
|
||||
return -ESRCH;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user