On Mon, Mar 27, 2017 at 6:09 PM, Alexander Bluhm <alexander.bl...@gmx.net> wrote:
> On Mon, Mar 27, 2017 at 05:39:27PM +0200, Mateusz Guzik wrote: > > The previous patch replaced multiple reads of the global var with just > > one read and had the result stored in a local variable, which then is > > read multiple times. Even though the compiler ended up emitting one read > > of the global, it perfectly legal to emit several, thus the bug can still > > reappear. This can be prevented as described above. > > It is not a problem when the compiler creates multiple read > instructions for syslogf as long no function call is between them. > Nothing else can change the content of syslogf in parallel, we are > running with the big kernel lock. > > It would be a problem if the compiler would do a read from the > global syslogf variable before and after a sleep. But that would > be illegal in C. Agreed. I somehow brainfarted myself into not realising it really can't reload the var across a func call which would be needed to give cpu to someone else. Sorry for the noise in that bit. -- Mateusz Guzik <mjguzik gmail.com>