kernel_optimize_test/kernel/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.c
autogroup.h
clock.c
completion.c
core.c sched/core: Remove unnecessary initialization init_idle_bootup_task() 2017-08-10 12:18:18 +02:00
cpuacct.c
cpuacct.h
cpudeadline.c sched/deadline: Change return value of cpudl_find() 2017-08-10 12:18:17 +02:00
cpudeadline.h
cpufreq_schedutil.c cpufreq: schedutil: Fix sugov_start() versus sugov_update_shared() race 2017-07-12 14:47:48 +02:00
cpufreq.c
cpupri.c sched/cpupri: Don't re-initialize 'struct cpupri' 2017-08-10 12:18:14 +02:00
cpupri.h
cputime.c sched/cputime: Don't use smp_processor_id() in preemptible context 2017-07-14 10:27:15 +02:00
deadline.c sched/deadline: Change return value of cpudl_find() 2017-08-10 12:18:17 +02:00
debug.c sched/debug: Use task_pid_nr_ns in /proc/$pid/sched 2017-08-10 12:18:19 +02:00
fair.c sched/numa: Scale scan period with tasks in group and shared/private 2017-08-10 12:18:16 +02:00
features.h
idle_task.c
idle.c
loadavg.c
Makefile
rt.c
sched-pelt.h
sched.h
stats.c
stats.h
stop_task.c
swait.c
topology.c sched: Mark pick_next_task_dl() and build_sched_domain() as static 2017-08-10 12:18:14 +02:00
wait_bit.c
wait.c