[PATCH v2 4/4] libio: Fix race access to _IO_FLAGS2_NEED_LOCK

Florian Weimer fweimer@redhat.com
Mon May 10 19:25:00 GMT 2021


* Florian Weimer:

> * Adhemerval Zanella:
>
>> I see that my first assumption of moving the _IO_FLAGS2_NEED_LOCK after
>> the lock should be suffice.  The data race is not really related to 
>> _IO_FLAGS2_NEED_LOCK set in fact, but rather the small window where 
>> the _flags2 read and update with _IO_FLAGS2_NEED_LOCK might lost some
>> bits update.
>
> Right.

Oh, and this a user-visible bug, so I filed:

  Race condition in _IO_FLAGS2_NEED_LOCK optimization
  <https://sourceware.org/bugzilla/show_bug.cgi?id=27842>

Please reference this bug in your commit message.

Thanks,
Florian



More information about the Libc-alpha mailing list