-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential use-after-free in when_all_vector
#966
Fix potential use-after-free in when_all_vector
#966
Conversation
a9094a6
to
7118873
Compare
The valgrind CI configuration shows the following error now, confirming that the new test triggers the failure:
Address sanitizer is a bit more verbose and shows what allocated and freed the block that is being accessed after the free:
|
cscs-ci run |
1 similar comment
cscs-ci run |
I think the failure reported on the
is a test/semantics issue, rather than a clear bug. It's triggered by this test: pika/libs/pika/execution/tests/unit/algorithm_ensure_started.cpp Lines 176 to 182 in eaae472
start_detached operation state may be released after main exits because the std::thread created by std_thread_scheduler isn't joined before main exits. I'll ignore the failure in this PR as it's not a new failure, and try to think of a way to restructure the test separately.
|
If the call to the last child operation state of
when_all_vector
actually releases thewhen_all_vector
operation state, the access to the number of predecessors from thewhen_all_vector
operation state will be on freed memory. This PR reads the number into a stack-local variable before starting the child operation states and introduces a test that triggers the failure without the fix.