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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1908262014260.1939@nanos.tec.linutronix.de>
Date:   Mon, 26 Aug 2019 20:16:03 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Frederic Weisbecker <frederic@...nel.org>
cc:     LKML <linux-kernel@...r.kernel.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        John Stultz <john.stultz@...aro.org>,
        Anna-Maria Behnsen <anna-maria@...utronix.de>,
        Christoph Hellwig <hch@....de>
Subject: Re: [patch V2 28/38] posix-cpu-timers: Restructure expiry array

On Mon, 26 Aug 2019, Frederic Weisbecker wrote:
> On Wed, Aug 21, 2019 at 09:09:15PM +0200, Thomas Gleixner wrote:
> >  /**
> > - * task_cputimers_expired - Compare two task_cputime entities.
> > + * task_cputimers_expired - Check whether posix CPU timers are expired
> >   *
> >   * @samples:	Array of current samples for the CPUCLOCK clocks
> > - * @expiries:	Array of expiry values for the CPUCLOCK clocks
> > + * @pct:	Pointer to a posix_cputimers container
> >   *
> > - * Returns true if any mmember of @samples is greater than the corresponding
> > - * member of @expiries if that member is non zero. False otherwise
> > + * Returns true if any member of @samples is greater than the corresponding
> > + * member of @pct->bases[CLK].nextevt. False otherwise
> >   */
> > -static inline bool task_cputimers_expired(const u64 *sample, const u64 *expiries)
> > +static inline bool
> > +task_cputimers_expired(const u64 *sample, struct posix_cputimers *pct)
> >  {
> >  	int i;
> >  
> >  	for (i = 0; i < CPUCLOCK_MAX; i++) {
> > -		if (expiries[i] && sample[i] >= expiries[i])
> > +		if (sample[i] >= pct->bases[i].nextevt)
> 
> You may have false positive here if you don't check if pct->bases[i].nextevt
> is 0. Probably no big deal by the end of the series since you change that 0
> for KTIME_MAX later but right now it might hurt bisection with performance
> issues (locking sighand at every tick...).

Hrm. That should have stayed until the patch  which removes that 0 state

> [...]
> 
> > @@ -1176,7 +1182,7 @@ void run_posix_cpu_timers(void)
> >  void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
> >  			   u64 *newval, u64 *oldval)
> >  {
> > -	u64 now, *expiry = tsk->signal->posix_cputimers.expiries + clkid;
> > +	u64 now, *nextevt = &tsk->signal->posix_cputimers.bases[clkid].nextevt;
> 
> You're dereferencing the pointer before checking clkid sanity below.

Urgh. Yes.
 
Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ