History

Merge tag 'threads-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull thread management updates from Christian Brauner: - A pidfd's fdinfo file currently contains the field "Pid:\t<pid>" where <pid> is the pid of the process in the pid namespace of the procfs instance the fdinfo file for the pidfd was opened in. The fdinfo file has now gained a new "NSpid:\t<ns-pid1>[\t<ns-pid2>[...]]" field which lists the pids of the process in all child pid namespaces provided the pid namespace of the procfs instance it is looked up under has an ancestoral relationship with the pid namespace of the process. If it does not 0 will be shown and no further pid namespaces will be listed. Tests included. (Christian Kellner) - If the process the pidfd references has already exited, print -1 for the Pid and NSpid fields in the pidfd's fdinfo file. Tests included. (me) - Add CLONE_CLEAR_SIGHAND. This lets callers clear all signal handler that are not SIG_DFL or SIG_IGN at process creation time. This originated as a feature request from glibc to improve performance and elimate races in their posix_spawn() implementation. Tests included. (me) - Add support for choosing a specific pid for a process with clone3(). This is the feature which was part of the thread update for v5.4 but after a discussion at LPC in Lisbon we decided to delay it for one more cycle in order to make the interface more generic. This has now done. It is now possible to choose a specific pid in a whole pid namespaces (sub)hierarchy instead of just one pid namespace. In order to choose a specific pid the caller must have CAP_SYS_ADMIN in all owning user namespaces of the target pid namespaces. Tests included. (Adrian Reber) - Test improvements and extensions. (Andrei Vagin, me) * tag 'threads-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: selftests/clone3: skip if clone3() is ENOSYS selftests/clone3: check that all pids are released on error paths selftests/clone3: report a correct number of fails selftests/clone3: flush stdout and stderr before clone3() and _exit() selftests: add tests for clone3() with *set_tid fork: extend clone3() to support setting a PID selftests: add tests for clone3() tests: test CLONE_CLEAR_SIGHAND clone3: add CLONE_CLEAR_SIGHAND pid: use pid_has_task() in pidfd_open() exit: use pid_has_task() in do_wait() pid: use pid_has_task() in __change_pid() test: verify fdinfo for pidfd of reaped process pidfd: check pid has attached task in fdinfo pidfd: add tests for NSpid info in fdinfo pidfd: add NSpid entries to fdinfo

Linus Torvalds committed 6 years ago

Commit 0acefef2 parents 9c91e6a 11fde1618 files · +1308 −58Browse files

Showing the changes to include/linux (3 of 18 files). Show all

Unified · Split

3 files
  1. include/linux/pid.h +6 −1
  2. include/linux/pid_namespace.h +2 −0
  3. include/linux/sched/task.h +3 −0
include/linux/pid.h+6−1
@@ -85,6 +85,10 @@ static inline struct pid *get_pid(struct pid *pid) · 84 unmodified lines
85 85
86extern void put_pid(struct pid *pid);86extern void put_pid(struct pid *pid);
87extern struct task_struct *pid_task(struct pid *pid, enum pid_type);87extern struct task_struct *pid_task(struct pid *pid, enum pid_type);
88static inline bool pid_has_task(struct pid *pid, enum pid_type type)
89{
90 return !hlist_empty(&pid->tasks[type]);
91}
88extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type);92extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type);
89 93
90extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);94extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
@@ -120,7 +124,8 @@ extern struct pid *find_vpid(int nr); · 29 unmodified lines
120extern struct pid *find_get_pid(int nr);124extern struct pid *find_get_pid(int nr);
121extern struct pid *find_ge_pid(int nr, struct pid_namespace *);125extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
122 126
123extern struct pid *alloc_pid(struct pid_namespace *ns);127extern struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
128 size_t set_tid_size);
124extern void free_pid(struct pid *pid);129extern void free_pid(struct pid *pid);
125extern void disable_pid_allocation(struct pid_namespace *ns);130extern void disable_pid_allocation(struct pid_namespace *ns);
126 131
include/linux/pid_namespace.h+2−0
@@ -12,6 +12,8 @@ · 11 unmodified lines
12#include <linux/ns_common.h>12#include <linux/ns_common.h>
13#include <linux/idr.h>13#include <linux/idr.h>
14 14
15/* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */
16#define MAX_PID_NS_LEVEL 32
15 17
16struct fs_pin;18struct fs_pin;
17 19
include/linux/sched/task.h+3−0
@@ -26,6 +26,9 @@ struct kernel_clone_args { · 25 unmodified lines
26 unsigned long stack;26 unsigned long stack;
27 unsigned long stack_size;27 unsigned long stack_size;
28 unsigned long tls;28 unsigned long tls;
29 pid_t *set_tid;
30 /* Number of elements in *set_tid */
31 size_t set_tid_size;
29};32};
30 33
31/*34/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t