Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1705635

Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched

From Jessie Frazelle <jessfraz@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched
Date 2017-08-07 17:20 +0200
Message-ID <ubRZ0-1OG-45@gated-at.bofh.it> (permalink)
References <ublFL-64V-5@gated-at.bofh.it> <ubLTB-5V4-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Thanks for patching this :) Guess I will find a different rabbit in a
hat to detect if running in a pid namespace ;)

On Mon, Aug 7, 2017 at 4:44 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Sun, Aug 06, 2017 at 02:41:41PM +1000, Aleksa Sarai wrote:
>> 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[1]). This lead 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.
>>
>> [1]: https://github.com/jessfraz/amicontained
>>
>> Cc: <stable@vger.kernel.org>
>> Cc: Jess Frazelle <acidburn@google.com>
>> Signed-off-by: Aleksa Sarai <asarai@suse.com>
>
> Thanks!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched Aleksa Sarai <asarai@suse.com> - 2017-08-06 06:50 +0200
  Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched ebiederm@xmission.com (Eric W. Biederman) - 2017-08-06 17:10 +0200
  Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched Peter Zijlstra <peterz@infradead.org> - 2017-08-07 10:50 +0200
    Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched Jessie Frazelle <jessfraz@google.com> - 2017-08-07 17:20 +0200
      Re: [PATCH v2] sched: debug: use task_pid_nr_ns in /proc/$pid/sched ebiederm@xmission.com (Eric W. Biederman) - 2017-08-08 17:30 +0200
  [tip:sched/core] sched/debug: Use task_pid_nr_ns in  /proc/$pid/sched tip-bot for Aleksa Sarai <tipbot@zytor.com> - 2017-08-10 14:20 +0200

csiph-web