pidfd and clone3 fixes
Hi Linus,
This contains a bugfix for CLONE_PIDFD when used with the legacy clone syscall. two fixes to ensure that syscall numbering and clone3 entrypoint implementations will stay consistent, and an update for the maintainers file:
The following changes since commit 964a4eacef67503a1154f7e0a75f52fbdce52022:
Merge tag 'dlm-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm (2019-07-12 17:37:53 -0700)
are available in the Git repository at:
[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-20190715
for you to fetch changes up to 69b53720e92c1bdea854a2fc204477ddabfa902b:
MAINTAINERS: add new entry for pidfd api (2019-07-15 12:59:44 +0200)
/* Summary */
The addition of clone3 broke CLONE_PIDFD for legacy clone on all architectures that use do_fork() directly instead of calling the clone syscall itself. (Fwiw, cleaning do_fork() up is on my todo.) The reason this happened was that during conversion of _do_fork() to use struct kernel_clone_args we missed that do_fork() is called directly by various architectures. This is fixed by making sure that the pidfd argument in struct kernel_clone_args is correctly initialized with the parent_tidptr argument passed down from do_fork(). Additionally, do_fork() missed a check to make CLONE_PIDFD and CLONE_PARENT_SETTID mutually exclusive just a clone() does. This is now fixed too.
When clone3() was introduced we skipped architectures that require special handling for fork-like syscalls. Their syscall tables did not contain any mention of clone3(). To make sure that Arnd's work to make syscall numbers on all architectures identical (minus alpha) was not for naught we are placing a comment in all syscall tables that do not yet implement clone3(). The comment makes it clear that 435 is reserved for clone3 and should not be used.
Also, this PR contains a patch to make the clone3() syscall definition in asm-generic/unist.h conditional on __ARCH_WANT_SYS_CLONE3. This lets us catch new architectures that implicitly make use of clone3 without setting __ARCH_WANT_SYS_CLONE3 which is a good indicator that they did not check whether it needs special treatment or not.
Last, this contains a patch to add me as maintainer for pidfd stuff so people can start blaming me (more).
Please consider pulling from the signed for-linus-20190715 tag.
Thanks!
Christian
----------------------------------------------------------------
for-linus-20190715
----------------------------------------------------------------
Christian Brauner (3):
arch: mark syscall number 435 reserved for clone3
unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3
MAINTAINERS: add new entry for pidfd api
Dmitry V. Levin (1):
clone: fix CLONE_PIDFD support
MAINTAINERS | 11 +++++++++++ arch/alpha/kernel/syscalls/syscall.tbl | 1 + arch/ia64/kernel/syscalls/syscall.tbl | 1 + arch/m68k/kernel/syscalls/syscall.tbl | 1 + arch/mips/kernel/syscalls/syscall_n32.tbl | 1 + arch/mips/kernel/syscalls/syscall_n64.tbl | 1 + arch/mips/kernel/syscalls/syscall_o32.tbl | 1 + arch/parisc/kernel/syscalls/syscall.tbl | 1 + arch/powerpc/kernel/syscalls/syscall.tbl | 1 + arch/s390/kernel/syscalls/syscall.tbl | 1 + arch/sh/kernel/syscalls/syscall.tbl | 1 + arch/sparc/kernel/syscalls/syscall.tbl | 1 + arch/x86/ia32/sys_ia32.c | 4 ++++ include/linux/sched/task.h | 1 + include/uapi/asm-generic/unistd.h | 2 ++ kernel/fork.c | 17 +++++++++++++++-- 16 files changed, 44 insertions(+), 2 deletions(-)
The pull request you sent on Mon, 15 Jul 2019 17:15:09 +0200:
The pull request you sent on Mon, 15 Jul 2019 17:15:09 +0200:
Quoted 1 line
[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-20190715
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/3c69914b4c7b0b72ff0275c14743778057ee8a6e
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Quoted 9 lines · On July 16, 2019 9:40:17 PM GMT+02:00, [email protected] wrote:
The pull request you sent on Mon, 15 Jul 2019 17:15:09 +0200:
Quoted 1 line
[email protected]:pub/scm/linux/kernel/git/brauner/linux
tags/for-linus-20190715
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/3c69914b4c7b0b72ff0275c14743778057ee8a6eThank you!
Btw, I also wanted to have a set of dedicated reviewers for files this whole API touched
in maintainers.
Especially fork, exit, and pid since we don't have any right now. Essentially, to ensure that we have a set
of eyes that need to be cc'ed on core changes.
I tried to get Oleg on board with me but he's pretty busy. It's something I still think would be good.
But maybe it's not needed.
Christian