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
| ||
|
Date: Mon, 20 Dec 2010 08:40:51 -0500 From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca> To: Peter Zijlstra <peterz@...radead.org> Cc: paulmck@...ux.vnet.ibm.com, Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com, dipankar@...ibm.com, akpm@...ux-foundation.org, josh@...htriplett.org, niv@...ibm.com, tglx@...utronix.de, rostedt@...dmis.org, Valdis.Kletnieks@...edu, dhowells@...hat.com, eric.dumazet@...il.com, darren@...art.com Subject: Re: [PATCH RFC tip/core/rcu 13/20] rcu: increase synchronize_sched_expedited() batching * Peter Zijlstra (peterz@...radead.org) wrote: > On Sun, 2010-12-19 at 08:35 -0800, Paul E. McKenney wrote: > > > (int)((unsigned)(a) - (unsigned)(b)) < 0 > > > > Unfortunately, no. :-( > > > > The (int) converts from unsigned to signed, and if the upper bit of > > the unsigned difference is non-zero, then the paragraph I quoted above > > applies, and the standard allows the compiler to do whatever it wants. > > > As noted in the previous reply, that would render quite a lot of our > time-keeping code broken. I think its safe to assume this works. > > Look at time_after() for example: > > #define time_after(a,b) \ > (typecheck(unsigned long, a) && \ > typecheck(unsigned long, b) && \ > ((long)(b) - (long)(a) < 0)) I agree with Peter: as long as the difference value is expected not to overflow a signed long, the time_after() approach should be safe. Now it depends if the usage Paul spotted is expected to have a difference that overflows a signed int. It's not clear to me that it's realistically possible from reading the patch, but I might be missing something. And by the way, if the difference is expected to overflow a signed int, then we're only a factor two away from overflowing an unsigned int, so the whole approach would be fragile. Thanks, Mathieu -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists