Skip to content

Commit af0622f

Browse files
committed
Merge tag 'for-linus-20191003' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux
Pull clone3/pidfd fixes from Christian Brauner: "This contains a couple of fixes: - Fix pidfd selftest compilation (Shuah Kahn) Due to a false linking instruction in the Makefile compilation for the pidfd selftests would fail on some systems. - Fix compilation for glibc on RISC-V systems (Seth Forshee) In some scenarios linux/uapi/linux/sched.h is included where __ASSEMBLY__ is defined causing a build failure because struct clone_args was not guarded by an #ifndef __ASSEMBLY__. - Add missing clone3() and struct clone_args kernel-doc (Christian Brauner) clone3() and struct clone_args were missing kernel-docs. (The goal is to use kernel-doc for any function or type where it's worth it.) For struct clone_args this also contains a comment about the fact that it's versioned by size" * tag 'for-linus-20191003' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: sched: add kernel-doc for struct clone_args fork: add kernel-doc for clone3 selftests: pidfd: Fix undefined reference to pthread_create() sched: Add __ASSEMBLY__ guards around struct clone_args
2 parents 768b47b + 78f6fac commit af0622f

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

include/uapi/linux/sched.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,31 @@
3333
#define CLONE_NEWNET 0x40000000 /* New network namespace */
3434
#define CLONE_IO 0x80000000 /* Clone io context */
3535

36-
/*
37-
* Arguments for the clone3 syscall
36+
#ifndef __ASSEMBLY__
37+
/**
38+
* struct clone_args - arguments for the clone3 syscall
39+
* @flags: Flags for the new process as listed above.
40+
* All flags are valid except for CSIGNAL and
41+
* CLONE_DETACHED.
42+
* @pidfd: If CLONE_PIDFD is set, a pidfd will be
43+
* returned in this argument.
44+
* @child_tid: If CLONE_CHILD_SETTID is set, the TID of the
45+
* child process will be returned in the child's
46+
* memory.
47+
* @parent_tid: If CLONE_PARENT_SETTID is set, the TID of
48+
* the child process will be returned in the
49+
* parent's memory.
50+
* @exit_signal: The exit_signal the parent process will be
51+
* sent when the child exits.
52+
* @stack: Specify the location of the stack for the
53+
* child process.
54+
* @stack_size: The size of the stack for the child process.
55+
* @tls: If CLONE_SETTLS is set, the tls descriptor
56+
* is set to tls.
57+
*
58+
* The structure is versioned by size and thus extensible.
59+
* New struct members must go at the end of the struct and
60+
* must be properly 64bit aligned.
3861
*/
3962
struct clone_args {
4063
__aligned_u64 flags;
@@ -46,6 +69,7 @@ struct clone_args {
4669
__aligned_u64 stack_size;
4770
__aligned_u64 tls;
4871
};
72+
#endif
4973

5074
/*
5175
* Scheduling policies

kernel/fork.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs)
26042604
return true;
26052605
}
26062606

2607+
/**
2608+
* clone3 - create a new process with specific properties
2609+
* @uargs: argument structure
2610+
* @size: size of @uargs
2611+
*
2612+
* clone3() is the extensible successor to clone()/clone2().
2613+
* It takes a struct as argument that is versioned by its size.
2614+
*
2615+
* Return: On success, a positive PID for the child process.
2616+
* On error, a negative errno number.
2617+
*/
26072618
SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
26082619
{
26092620
int err;

tools/testing/selftests/pidfd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
CFLAGS += -g -I../../../../usr/include/ -lpthread
2+
CFLAGS += -g -I../../../../usr/include/ -pthread
33

44
TEST_GEN_PROGS := pidfd_test pidfd_open_test pidfd_poll_test pidfd_wait
55

0 commit comments

Comments
 (0)