linux-stable/include/linux/sched
Aleksa Sarai 74dc3384fc sched/debug: Use task_pid_nr_ns in /proc/$pid/sched
It appears as though the addition of the PID namespace did not update
the output code for /proc/*/sched, which resulted in it providing PIDs
that were not self-consistent with the /proc mount. This additionally
made it trivial to detect whether a process was inside &init_pid_ns from
userspace, making container detection trivial:

   https://github.com/jessfraz/amicontained

This leads to situations such as:

  % unshare -pmf
  % mount -t proc proc /proc
  % head -n1 /proc/1/sched
  head (10047, #threads: 1)

Fix this by just using task_pid_nr_ns for the output of /proc/*/sched.
All of the other uses of task_pid_nr in kernel/sched/debug.c are from a
sysctl context and thus don't need to be namespaced.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jess Frazelle <acidburn@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: cyphar@cyphar.com
Link: http://lkml.kernel.org/r/20170806044141.5093-1-asarai@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-08-10 12:18:19 +02:00
..
autogroup.h sched/headers: Remove <linux/sched.h> from <linux/sched/autogroup.h> 2017-03-03 01:45:29 +01:00
clock.h sched/clock: Use late_initcall() instead of sched_init_smp() 2017-05-15 10:15:21 +02:00
coredump.h mm: make PR_SET_THP_DISABLE immediately active 2017-07-10 16:32:31 -07:00
cpufreq.h sched/headers: Remove <linux/sched.h> from <linux/sched/cpufreq.h> 2017-03-03 01:45:32 +01:00
cputime.h sched/headers: Move cputime functionality from <linux/sched.h> and <linux/cputime.h> into <linux/sched/cputime.h> 2017-03-03 01:45:22 +01:00
deadline.h
debug.h sched/debug: Use task_pid_nr_ns in /proc/$pid/sched 2017-08-10 12:18:19 +02:00
hotplug.h sched/headers: Remove <linux/sched.h> from <linux/sched/hotplug.h> 2017-03-03 01:45:35 +01:00
idle.h sched/headers: Remove tsk_is_polling() 2017-03-03 01:45:27 +01:00
init.h sched/headers: Remove <linux/sched.h> from <linux/sched/init.h> 2017-03-03 01:45:38 +01:00
jobctl.h sched/headers: Move the JOBCTL_ defines and methods from <linux/sched.h> to <linux/sched/jobctl.h> 2017-03-03 01:43:41 +01:00
loadavg.h sched/headers: Remove <linux/sched.h> from <linux/sched/loadavg.h> 2017-03-03 01:45:28 +01:00
mm.h mm: introduce memalloc_noreclaim_{save,restore} 2017-05-08 17:15:15 -07:00
nohz.h MAINTAINERS: Add Frederic Weisbecker as nohz/dyntics maintainer 2017-07-05 16:26:37 +02:00
numa_balancing.h sched/headers: Move the NUMA balancing interfaces from <linux/sched.h> to <linux/sched/numa_balancing.h> 2017-03-03 01:43:40 +01:00
prio.h
rt.h sched/rtmutex: Refactor rt_mutex_setprio() 2017-04-04 11:44:06 +02:00
signal.h randstruct: Mark various structs for randomization 2017-06-30 12:00:51 -07:00
stat.h sched/headers: Remove <linux/sched.h> from <linux/sched/stat.h> 2017-03-03 01:45:34 +01:00
sysctl.h
task.h sched/core: Remove unnecessary initialization init_idle_bootup_task() 2017-08-10 12:18:18 +02:00
task_stack.h sched/headers: Move kstack_end() from <linux/sched.h> to <linux/sched/task_stack.h> 2017-03-03 01:45:24 +01:00
topology.h sched/headers: Remove the <linux/topology.h> include from <linux/sched.h> 2017-03-03 01:45:41 +01:00
user.h sched/headers: Remove <linux/sched.h> from <linux/sched/user.h> 2017-03-03 01:45:30 +01:00
wake_q.h sched/headers: Move the wake-queue types and interfaces from sched.h into <linux/sched/wake_q.h> 2017-03-02 08:42:42 +01:00
xacct.h sched/headers: Move CONFIG_TASK_XACCT bits from <linux/sched.h> to <linux/sched/xacct.h> 2017-03-03 01:43:41 +01:00