lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130910091847.GQ26785@twins.programming.kicks-ass.net>
Date:	Tue, 10 Sep 2013 11:18:47 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Emmanuel Deloget <emmanuel.deloget@...xo.com>
Cc:	"[ML] linux-kernel" <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: /proc/$PID/sched does not take PID namespace into account

On Mon, Sep 09, 2013 at 01:01:41PM +0200, Peter Zijlstra wrote:
> On Tue, Sep 03, 2013 at 04:22:33PM +0200, Emmanuel Deloget wrote:
> > The issue (if this is really an issue) lies in kernel/sched/debug.c,
> > function proc_sched_show_task(). The code says [1]:
> > 
> >     SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid,
> >                         get_nr_threads(p));
> > 
> 
> > I see a few options:
> > 
> > * either it's a bug and it should be corrected (I'm not sure how to
> >   do it; the printed PID should reflect the current PID namespace
> >   and I don't how how to get this information).
> 
> I suppose something like the below ought to work? -- completely
> untested, please confirm.
> 
> ---
> Subject: sched, debug: Use PID namespaces
> 
> Emmanuel reported that /proc/sched_debug didn't report the right PIDs
> when using namespaces, cure this.
> 
> Reported-by: Emmanuel Deloget <emmanuel.deloget@...xo.com>
> Signed-off-by: Peter Zijlstra <peterz@...radead.org>
> ---
>  kernel/sched/debug.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index e076bdd..e30bf44 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -124,7 +124,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
>  		SEQ_printf(m, " ");
>  
>  	SEQ_printf(m, "%15s %5d %9Ld.%06ld %9Ld %5d ",
> -		p->comm, p->pid,
> +		p->comm, task_pid(p),,
>  		SPLIT_NS(p->se.vruntime),
>  		(long long)(p->nvcsw + p->nivcsw),
>  		p->prio);
> @@ -289,7 +289,7 @@ do {									\
>  	P(nr_load_updates);
>  	P(nr_uninterruptible);
>  	PN(next_balance);
> -	P(curr->pid);
> +	P(task_pid(curr));
>  	PN(clock);
>  	P(cpu_load[0]);
>  	P(cpu_load[1]);
> @@ -492,7 +492,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
>  {
>  	unsigned long nr_switches;
>  
> -	SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid,
> +	SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, task_pid(p),
>  						get_nr_threads(p));
>  	SEQ_printf(m,
>  		"---------------------------------------------------------"

Please do s/task_pid/task_pid_nr/g on this before trying. 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ