[FFmpeg-devel] [PATCH] avutil: fix data race in av_get_cpu_flags()
Michael Niedermayer
michael at niedermayer.cc
Tue Dec 13 01:39:16 EET 2016
On Tue, Dec 06, 2016 at 06:16:13PM -0800, Wan-Teh Chang wrote:
> Make the one-time initialization in av_get_cpu_flags() thread-safe. The
> static variable |cpu_flags| in libavutil/cpu.c is read and written using
> normal load and store operations. These are considered as data races.
> The fix is to use atomic load and store operations.
>
> The fix can be verified by running the libavutil/tests/cpu_init.c test
> program under ThreadSanitizer:
> ./configure --toolchain=clang-tsan
> make libavutil/tests/cpu_init
> libavutil/tests/cpu_init
>
> There should be no warnings from ThreadSanitizer.
>
> Co-author: Dmitry Vyukov of Google, who suggested the data race fix.
>
> Signed-off-by: Wan-Teh Chang <wtc at google.com>
> ---
> libavutil/cpu.c | 12 +++++++-----
> libavutil/cpu.h | 2 --
> 2 files changed, 7 insertions(+), 7 deletions(-)
applied
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161213/ae6a0dd2/attachment.sig>
More information about the ffmpeg-devel
mailing list