HomePhabricator

test: Fix use-after-free in scheduler tests
12519bf62b8cUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

test: Fix use-after-free in scheduler tests

Make a copy of the boost time-point to wait for, otherwise the head of
the queue may be deleted by another thread while this one is waiting,
while the boost function still has a reference to it.

Although this problem is in non-test code, this is not an actual problem
outside of the tests because we use the thread scheduler with only one
service thread, so there will never be threads fighting at the head of
the queue.

The old boost fallback escapes this problem because it passes a scalar
value to wait_until instead of a const object reference.

Found by running the tests in LLVM-4.0-master asan.

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Nov 18 2016, 12:08
schancelPushed on Jan 5 2018, 21:58
schancelPushed on Jan 5 2018, 21:39
schancelPushed on Jan 5 2018, 21:17
Parents
rSTAGINGa8b2a82618be: Merge #9156: Add compile and link options echo to configure
Branches
Unknown
Tags
Unknown

Event Timeline

Wladimir J. van der Laan <laanwj@gmail.com> committed rSTAGING12519bf62b8c: test: Fix use-after-free in scheduler tests (authored by Wladimir J. van der Laan <laanwj@gmail.com>).Nov 18 2016, 12:10