ffmpeg/libavutil
Wan-Teh Chang 2170017a1c avutil: fix data race in av_get_cpu_flags()
Make the one-time initialization in av_get_cpu_flags() thread-safe. The
static variables |flags|, |cpuflags_mask|, and |checked| in
libavutil/cpu.c are 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.

Remove the |checked| variable because the invalid value of -1 for
|flags| can be used to indicate the same condition. Rename |flags| to
|cpu_flags| and move it to file scope.

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@google.com>
2016-12-08 15:53:58 -05:00
..
aarch64 aarch64: Add an offset parameter to the movrel macro 2016-11-10 11:06:08 +02:00
arm arm: warn/error on movrelx usage problematic with PIC on ELF 2016-11-24 21:26:22 +01:00
avr32 cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
bfin
mips
ppc
sh4
tests avutil: fix data race in av_get_cpu_flags() 2016-12-08 15:53:58 -05:00
tomi
x86 float_dsp: Have implementation match function pointer prototype 2016-11-03 17:43:55 +01:00
.gitignore Split global .gitignore file into per-directory files 2016-05-13 14:55:56 +02:00
Makefile avutil: fix data race in av_get_cpu_flags() 2016-12-08 15:53:58 -05:00
adler32.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
adler32.h
aes.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
aes.h
attributes.h libavutil: Always use some GCC style attributes on clang 2016-07-21 12:52:19 +03:00
audio_fifo.c audio_fifo: Drop write-only variable 2016-10-27 12:21:46 +02:00
audio_fifo.h
avassert.h cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
avstring.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
avstring.h
avutil.h lavu: Add a video section to Doxygen documentation 2016-12-07 14:26:21 -05:00
base64.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
base64.h
blowfish.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
blowfish.h
bswap.h
buffer.c buffer: convert to stdatomic 2016-10-02 18:58:04 +02:00
buffer.h buffer: fix av_buffer_pool_init2() documentation 2016-08-11 10:29:23 +02:00
buffer_internal.h buffer: convert to stdatomic 2016-10-02 18:58:04 +02:00
channel_layout.c
channel_layout.h
colorspace.h colorspace: Add support for BT709 2016-05-10 11:30:25 +02:00
common.h lavu: add AV_CEIL_RSHIFT and use it in various places 2016-01-11 15:32:56 -05:00
cpu.c avutil: fix data race in av_get_cpu_flags() 2016-12-08 15:53:58 -05:00
cpu.h avutil: fix data race in av_get_cpu_flags() 2016-12-08 15:53:58 -05:00
cpu_internal.h
crc.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
crc.h
des.c tests: Move all test programs to a subdirectory 2016-05-13 14:55:56 +02:00
des.h
dict.c
dict.h cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
display.c
display.h lavu: Add a video section to Doxygen documentation 2016-12-07 14:26:21 -05:00
downmix_info.c
downmix_info.h
error.c
error.h
eval.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
eval.h
fifo.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
fifo.h
file.c
file.h
file_open.c
float_dsp.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
float_dsp.h
frame.c lavc: export the timestamps when decoding in AVFrame.pts 2016-06-21 19:54:42 +02:00
frame.h lavu: Add AVSphericalMapping type and frame side data 2016-12-07 14:32:17 -05:00
hmac.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
hmac.h
hwcontext.c hwcontext: Hardware frame mapping 2016-11-03 23:49:01 +00:00
hwcontext.h Drop some bogus Doxygen documentation. 2016-11-21 14:29:11 +01:00
hwcontext_cuda.c hwcontext_cuda: Add P010 and YUV444P16 pixel format 2016-09-22 09:47:48 +02:00
hwcontext_cuda.h hwcontext: add a CUDA implementation 2016-02-14 22:08:33 +01:00
hwcontext_dxva2.c hwcontext_dxva2: make sure the sw frame format is the right one during transfer 2016-11-18 10:31:53 +01:00
hwcontext_dxva2.h hwcontext: add a dxva2 implementation 2016-05-17 09:11:25 +02:00
hwcontext_internal.h hwcontext: Hardware frame mapping 2016-11-03 23:49:01 +00:00
hwcontext_qsv.c hwcontext_qsv: support frame mapping 2016-11-07 12:47:40 +01:00
hwcontext_qsv.h hwcontext: add a QSV implementation 2016-06-21 19:53:37 +02:00
hwcontext_vaapi.c hwcontext_vaapi: Don't abort on failing to allocate from a fixed-size pool 2016-11-26 18:03:05 +00:00
hwcontext_vaapi.h hwcontext_vaapi: add a quirk for the missing MemoryType attribute 2016-10-02 11:41:45 +02:00
hwcontext_vdpau.c hwcontext_vdpau: Fix missing subscripts 2016-09-14 20:48:36 +01:00
hwcontext_vdpau.h hwcontext: add a VDPAU implementation 2016-02-14 22:06:04 +01:00
imgutils.c imgutils: add a function for copying image data from GPU mapped memory 2016-08-31 08:15:47 +02:00
imgutils.h Fix some mismatches between function parameter and doxygen parameter names. 2016-11-21 14:29:10 +01:00
imgutils_internal.h imgutils: add a function for copying image data from GPU mapped memory 2016-08-31 08:15:47 +02:00
internal.h lavu: add LOCAL_ALIGNED_32 2016-08-03 10:56:52 +02:00
intfloat.h
intmath.c
intmath.h
intreadwrite.h Revert "libavutil: Use an intermediate variable in AV_COPY*U" 2016-08-02 21:18:18 +03:00
lfg.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
lfg.h
libavutil.v build: Change structure of the linker version script templates 2016-05-29 16:43:11 +02:00
libm.h
lls.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
lls.h
log.c
log.h
log2_tab.c
lzo.c
lzo.h
macros.h
mathematics.c mathematics: Kill non-compiling disabled cruft 2016-08-17 12:16:42 +02:00
mathematics.h
md5.c cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
md5.h
mem.c Drop memalign hack 2016-09-03 15:11:29 +02:00
mem.h libavutil: Always use some GCC style attributes on clang 2016-07-21 12:52:19 +03:00
opt.c Drop unreachable break and return statements 2016-11-03 20:17:12 +01:00
opt.h cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
parseutils.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
parseutils.h
pixdesc.c lavu: Rename ycgco color space appropriately 2016-11-08 11:22:29 -05:00
pixdesc.h pixdesc: Use AV_CEIL_RSHIFT in documentation 2016-01-25 12:02:20 -05:00
pixfmt.h lavu: Document the color properties enumeration values origin 2016-12-02 11:36:46 -05:00
random_seed.c cosmetics: Fix spelling mistakes 2016-05-04 18:16:21 +02:00
random_seed.h
rational.c
rational.h
rc4.c
rc4.h
replaygain.h cosmetics: Drop empty comment lines 2016-02-18 15:35:30 +01:00
samplefmt.c
samplefmt.h cosmetics: Drop empty comment lines 2016-02-18 15:35:30 +01:00
sha.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
sha.h
spherical.c lavu: Add AVSphericalMapping type and frame side data 2016-12-07 14:32:17 -05:00
spherical.h Add missing #includes for standalone spherical-information-related headers 2016-12-08 20:12:23 +01:00
stereo3d.c stereo3d: Add API to get name from value or value from name 2016-05-17 12:25:27 -04:00
stereo3d.h lavu: Add a video section to Doxygen documentation 2016-12-07 14:26:21 -05:00
thread.h
time.c
time.h
time_internal.h
timer.h
tree.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
tree.h
utils.c
version.h lavc: Add spherical packet side data API 2016-12-07 14:34:34 -05:00
wchar_filename.h
xtea.c build: Split test programs off into separate files 2016-04-07 16:14:42 +02:00
xtea.h