Skip to content
Snippets Groups Projects
Commit cdbddaff authored by Florian Fischer's avatar Florian Fischer
Browse files

fix lockless io-stealing

The uninitialized continuation pointer may be returned without being
written resulting in dispatching a not valid fiber pointer.

If a CQE is stolen but no fiber is blocked on the corresponding future
IoContext::getContinuationsFromCompletions will call future->completeAndGetContinuation
which will set the future's completion but will not return a continuation.

If no continuation is returned from Future::completeAndGetContinuation
the continuation buffer is not advanced by IoContext::getContinuationsFromCompletions
(emper/io/IoContext.hpp:259).

IoContext::reapSingleCompletion does not check if a continuation was
created and assumed that continuation contains a valid Fiber* if
a CQE was successfully stolen.

Initialize continuation with nullptr, which is a valid Fiber*.
parent 7d341a2e
No related branches found
No related tags found
1 merge request!357fix lockless io-stealing
......@@ -476,7 +476,7 @@ class IoContext : public Logger<LogSubsystem::IO> {
*/
template <CallerEnvironment callerEnvironment>
[[nodiscard]] auto reapSingleCompletion() -> Fiber * {
Fiber *fiber;
Fiber *fiber = nullptr;
if constexpr (emper::WAITFREE_IO_STEALING) {
auto res = tryReapCompletionWaitFree<callerEnvironment>(&fiber);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment