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]
Date:   Mon, 24 Oct 2016 14:29:42 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     "Ni, BaoleX" <baolex.ni@...el.com>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "Liu, Chuansheng" <chuansheng.liu@...el.com>
Subject: Re: hit a KASan bug related to Perf during stress test

On 10/24, Peter Zijlstra wrote:
>
> On Mon, Oct 24, 2016 at 02:10:31PM +0200, Oleg Nesterov wrote:
> > --- x/kernel/pid.c
> > +++ x/kernel/pid.c
> > @@ -526,8 +526,11 @@ pid_t __task_pid_nr_ns(struct task_struc
> >  	if (!ns)
> >  		ns = task_active_pid_ns(current);
> >  	if (likely(pid_alive(task))) {
> > -		if (type != PIDTYPE_PID)
> > +		if (type != PIDTYPE_PID) {
> > +			if (type == PIDTYPE_TGID)
> > +				type = PIDTYPE_PID;
> >  			task = task->group_leader;
> > +		}
>
> Aah, that makes much more sense ;-)
>
> >  		nr = pid_nr_ns(rcu_dereference(task->pids[type].pid), ns);
> >  	}
> >  	rcu_read_unlock();
>
>
> Still, I wonder if returning 0 is the right thing. 0 is a 'valid' PID
> for the init/idle task.

Yes, now I think that -1 would make more sense. Unfortunately we can't
just change __task_pid_nr_ns(), it already has the users which assume
it returns zero... attach_to_pi_state() for example.

> And we still have the re-use issue for the TID, because when we get here
> TID is already unhashed too afaict,

Yes, so perf_event_tid() will report zero.

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ