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: Wed, 16 Dec 2020 01:27:43 +0100 From: Thomas Gleixner <tglx@...utronix.de> To: paulmck@...nel.org, Peter Zijlstra <peterz@...radead.org> Cc: Marco Elver <elver@...gle.com>, LKML <linux-kernel@...r.kernel.org>, kasan-dev <kasan-dev@...glegroups.com>, Ingo Molnar <mingo@...nel.org>, Frederic Weisbecker <frederic@...nel.org>, Will Deacon <will@...nel.org>, Naresh Kamboju <naresh.kamboju@...aro.org>, syzbot+23a256029191772c2f02@...kaller.appspotmail.com, syzbot+56078ac0b9071335a745@...kaller.appspotmail.com, syzbot+867130cb240c41f15164@...kaller.appspotmail.com Subject: Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races On Tue, Dec 08 2020 at 07:03, Paul E. McKenney wrote: > On Tue, Dec 08, 2020 at 09:11:29AM +0100, Peter Zijlstra wrote: >> On Mon, Dec 07, 2020 at 11:44:06AM -0800, Paul E. McKenney wrote: >> >> > Also, in this particular case, why data_race() rather than READ_ONCE()? >> > Do we really expect the compiler to be able to optimize this case >> > significantly without READ_ONCE()? There is probably not much optimization potential for the compiler if data_race() is used vs. READ/WRITE_ONCE() in this code. >> It's about intent and how the code reads. READ_ONCE() is something >> completely different from data_race(). data_race() is correct here. > > Why? Lemme answer that to the extent why _I_ chose data_race() - aside of my likely confusion over our IRC conversation. The code does not really care about the compiler trying to be clever or not as it is designed to be tolerant of all sorts of concurrency including competing writes. It does not care about multiple reloads either. It neither cares about invented stores as long as these invented stores are not storing phantasy values. The only thing it cares about is store/load tearing, but there is no 'clever' way to use that because of the only valid transitions of 'cpunr' which comes from smp_processor_id() to TICK_DO_TIMER_NONE which is the only constant involved or the other way round (which is intentionally subject to competing stores). If the compiler is free to store the 32bit value as 4 seperate bytes or does invented stores with phantasy values, then there is surely a reason to switch to READ/WRITE_ONCE(), but that'd be a really daft reason. So my intent was to document that this code does not care about anything else than what I'd consider to be plain compiler bugs. My conclusion might be wrong as usual :) Thanks, tglx
Powered by blists - more mailing lists