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:	Thu, 23 Dec 2010 18:38:21 +0100
From:	Dario Faggioli <raistlin@...ux.it>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	torbenh <torbenh@....de>, john.stultz@...aro.org,
	roland@...hat.com, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Stanislaw Gruszka <sgruszka@...hat.com>
Subject: Re: [PATCH] Read THREAD_CPUTIME clock from other  processes.

On Thu, 2010-12-23 at 17:44 +0100, Oleg Nesterov wrote: 
> > Therefore, this patch removes such limitation and enables the
> > following behaviour, for the threaded and process-based case,
> > respectively:
> 
> Can't comment, I never understood this.
> 
If I can ask... What's that you never understood? Why the limitation is
there? Or something else?

> >  	rcu_read_lock();
> >  	p = find_task_by_vpid(pid);
> > -	if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
> > -		   same_thread_group(p, current) : has_group_leader_pid(p))) {
> > +	if (!p)
> >  		error = -EINVAL;
> > -	}
> 
> This changes the behaviour of sys_clock_settime(). Probably doesn't
> matter since it does nothing, but perhaps !CPUCLOCK_PERTHREAD &&
> !group_leader should result in -EINAVL as before.
> 
Oops, sure, you're right, I can fix this. :-)

> > @@ -349,18 +347,21 @@ int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)
> >  		rcu_read_lock();
> >  		p = find_task_by_vpid(pid);
> >  		if (p) {
> > -			if (CPUCLOCK_PERTHREAD(which_clock)) {
> > -				if (same_thread_group(p, current)) {
> > -					error = cpu_clock_sample(which_clock,
> > -								 p, &rtn);
> > -				}
> > +
> > +			if (CPUCLOCK_PERTHREAD(which_clock) &&
> > +			    same_thread_group(p, current)) {
> > +				error = cpu_clock_sample(which_clock,
> > +							 p, &rtn);
> >  			} else {
> >  				read_lock(&tasklist_lock);
> > -				if (thread_group_leader(p) && p->sighand) {
> > +				if (!CPUCLOCK_PERTHREAD(which_clock) &&
> > +				    thread_group_leader(p) && p->sighand)
> >  					error =
> >  					    cpu_clock_sample_group(which_clock,
> > -							           p, &rtn);
> > -				}
> > +								   p, &rtn);
> > +				else
> > +					error = cpu_clock_sample(which_clock,
> > +								 p, &rtn);
> >  				read_unlock(&tasklist_lock);
> 
> Can't understand... why did you duplicate cpu_clock_sample() ?
> 
> IOW, it seems to me you could simply kill the
> "if (same_thread_group(p, current)) {" line with the same efect, no?
> 
Well, yes, but looking at the original code I thought that in the !
same_thread_group() case I might need the tasklist_lock...

Am I wrong? Is it there just because of cpu_clock_sample_group()?

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa  (Italy)

http://retis.sssup.it/people/faggioli -- dario.faggioli@...ber.org

Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ