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:   Tue, 17 May 2022 14:08:12 +0200
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Theodore Ts'o <tytso@....edu>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] locking/lockdep: Use sched_clock() for random numbers.

On 2022-05-17 11:59:19 [+0200], Jason A. Donenfeld wrote:
> On Tue, May 17, 2022 at 11:53:43AM +0200, Jason A. Donenfeld wrote:
> > Hi Sebastian,

Hi Jason,

> > Interesting RT consideration. I hope there aren't too many of these
> > special cases that would necessitate a general mechanism. Fingers
> > crossed this is the only one.

lockdep is special here. Haven't seen other explosions so far ;)

> > On Tue, May 17, 2022 at 11:16:14AM +0200, Sebastian Andrzej Siewior wrote:
> > > -			cookie.val = 1 + (prandom_u32() >> 16);
> > > +			cookie.val = 1 + (sched_clock() & 0xffff);
> > >  			hlock->pin_count += cookie.val;
> >  
> > I have no idea what the requirements here are. What would happen if you
> > just did atomic_inc_return(&some_global) instead? That'd be faster
> > anyhow, and it's not like 16 bits gives you much variance anyway...

it might work I guess. PeterZ? Would this_cpu_inc_return() work?

> Also, what is that `1 +` doing there? If the intention is to make sure
> this is non-zero, you might want the mask to be 0xfffe? Or you're
> counting on the assigned type being a u32 so it all overflows into the
> next zone the way you want it? Kinda weird.

hmm. It used to be 1 before prandom_u32() was introduced and the point
is probably to have a cookie != 0. val and pin_count are both unsigned
int/ 32bit so that overflow doesn't matter.

> Jason

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ