Skip to content

Commit 230536f

Browse files
committed
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/[email protected] Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 03c212b commit 230536f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/pidfs.c

+8
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
271271
struct ns_common *ns_common = NULL;
272272
struct pid_namespace *pid_ns;
273273

274+
if (cmd == FS_IOC_GETVERSION) {
275+
if (!arg)
276+
return -EINVAL;
277+
278+
__u32 __user *argp = (__u32 __user *)arg;
279+
return put_user(file_inode(file)->i_generation, argp);
280+
}
281+
274282
task = get_pid_task(pid, PIDTYPE_PID);
275283
if (!task)
276284
return -ESRCH;

0 commit comments

Comments
 (0)