diff options
| author | Peter Collingbourne <pcc@google.com> | 2021-12-02 12:38:46 -0800 |
|---|---|---|
| committer | Peter Collingbourne <pcc@google.com> | 2021-12-02 12:45:54 -0800 |
| commit | c5b81844b6b61d357cefa65112758ffed1a649ed (patch) | |
| tree | 0a556e41fdc8d1b956a123d208c4a4c8726274f2 /libc/malloc_hooks/tests/malloc_hooks_tests.cpp | |
| parent | 5205e8ac5e4f1534bce09f6bb8a396a7520fe11a (diff) | |
Fix a race condition in the bionic pthread tests.
It's possible for the main thread to leave the RunTimedTest
function before the waiting thread has had a chance to call e.g.
pthread_cond_timedwait(). In this case, pthread_cond_timedwait()
will access the local variable ts after its lifetime has ended. Fix
the bug by making ts a field of pthread_CondWakeupTest instead. The
lifetime of pthread_CondWakeupTest is tied to that of the waiting
thread via the pthread_join() call.
Found with HWASan + uaccess logging.
Change-Id: Iefe8deb30a367dc518013d741c425b041596b0d3
Diffstat (limited to 'libc/malloc_hooks/tests/malloc_hooks_tests.cpp')
0 files changed, 0 insertions, 0 deletions
