431 common fsconfig sys_fsconfig
432 common fsmount sys_fsmount
433 common fspick sys_fspick
-436 common clone3 sys_clone3
+434 common pidfd_open sys_pidfd_open
++435 common clone3 sys_clone3
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
- #define __NR_compat_syscalls 435
-#define __NR_compat_syscalls 437
++#define __NR_compat_syscalls 436
#endif
#define __ARCH_WANT_SYS_CLONE
__SYSCALL(__NR_fsmount, sys_fsmount)
#define __NR_fspick 433
__SYSCALL(__NR_fspick, sys_fspick)
-#define __NR_clone3 436
+#define __NR_pidfd_open 434
+__SYSCALL(__NR_pidfd_open, sys_pidfd_open)
++#define __NR_clone3 435
+ __SYSCALL(__NR_clone3, sys_clone3)
/*
* Please add new compat syscalls above this comment and update
431 common fsconfig sys_fsconfig
432 common fsmount sys_fsmount
433 common fspick sys_fspick
-436 common clone3 sys_clone3
+434 common pidfd_open sys_pidfd_open
++435 common clone3 sys_clone3
431 i386 fsconfig sys_fsconfig __ia32_sys_fsconfig
432 i386 fsmount sys_fsmount __ia32_sys_fsmount
433 i386 fspick sys_fspick __ia32_sys_fspick
-436 i386 clone3 sys_clone3 __ia32_sys_clone3
+434 i386 pidfd_open sys_pidfd_open __ia32_sys_pidfd_open
++435 i386 clone3 sys_clone3 __ia32_sys_clone3
431 common fsconfig __x64_sys_fsconfig
432 common fsmount __x64_sys_fsmount
433 common fspick __x64_sys_fspick
-436 common clone3 __x64_sys_clone3/ptregs
+434 common pidfd_open __x64_sys_pidfd_open
++435 common clone3 __x64_sys_clone3/ptregs
#
# x32-specific system call numbers start at 512 to avoid cache impact
431 common fsconfig sys_fsconfig
432 common fsmount sys_fsmount
433 common fspick sys_fspick
-436 common clone3 sys_clone3
+434 common pidfd_open sys_pidfd_open
++435 common clone3 sys_clone3
__SYSCALL(__NR_fsmount, sys_fsmount)
#define __NR_fspick 433
__SYSCALL(__NR_fspick, sys_fspick)
-#define __NR_clone3 436
+#define __NR_pidfd_open 434
+__SYSCALL(__NR_pidfd_open, sys_pidfd_open)
++#define __NR_clone3 435
+ __SYSCALL(__NR_clone3, sys_clone3)
#undef __NR_syscalls
- #define __NR_syscalls 435
-#define __NR_syscalls 437
++#define __NR_syscalls 436
/*
* 32 bit systems traditionally used different
int pidfd = -1, retval;
struct task_struct *p;
struct multiprocess_signals delayed;
+ struct file *pidfile = NULL;
+ u64 clone_flags = args->flags;
/*
* Don't allow sharing the root directory with processes in a different
goto bad_fork_free_pid;
pidfd = retval;
- retval = put_user(pidfd, parent_tidptr);
+
+ pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops, pid,
+ O_RDWR | O_CLOEXEC);
+ if (IS_ERR(pidfile)) {
+ put_unused_fd(pidfd);
+ retval = PTR_ERR(pidfile);
+ goto bad_fork_free_pid;
+ }
+ get_pid(pid); /* held by pidfile now */
+
+ retval = put_user(pidfd, args->pidfd);
if (retval)
goto bad_fork_put_pidfd;
}