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: <20180328114434.3a05d3bc@gandalf.local.home>
Date:   Wed, 28 Mar 2018 11:44:34 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Wang Yu <yuwang@...ux.alibaba.com>
Cc:     Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ftrace: fix task's invalid comm of <...> when big pid

On Wed, 28 Mar 2018 11:35:22 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Wed, 28 Mar 2018 20:32:27 +0800
> Wang Yu <yuwang@...ux.alibaba.com> wrote:
> 
> > when pid is bigger than PID_MAX_DEFAULT, the comm of task
> > is <...>, it is better use pid_max to compare
> > 
> > Signed-off-by: Wang Yu <yuwang@...ux.alibaba.com>
> > ---
> >  kernel/trace/trace.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >  mode change 100644 => 100755 kernel/trace/trace.c
> > 
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > old mode 100644
> > new mode 100755
> > index 20a2300..0d4bc7a
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -1976,7 +1976,7 @@ static void __trace_find_cmdline(int pid, char comm[])
> >  		return;
> >  	}
> >  
> > -	if (pid > PID_MAX_DEFAULT) {
> > +	if (pid > pid_max) {  
> 
> Thanks! this probably should go to stable.

I take that back. This patch can cause a buffer overflow access.

If you looked at the line after this check, you would see:

	if (pid > PID_MAX_DEFAULT) {
		strcpy(comm, "<...>");
		return;
	}

	map = savedcmd->map_pid_to_cmdline[pid];

And if you looked to see what map_pid_to_cmdline is:

struct saved_cmdlines_buffer {
	unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];

Your patch will access memory past the end of that array, and cause a
bug.

If you want to support more than PID_MAX_DEFAULT, a lot more needs to
change than this. And a change like this isn't going to go to stable.

What you can do is make that map_pid_to_cmdline array bigger.

-- Steve


> 
> -- Steve
> 
> >  		strcpy(comm, "<...>");
> >  		return;
> >  	}  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ