Skip to content
Snippets Groups Projects
Commit 07db6859 authored by Kevin Wolf's avatar Kevin Wolf Committed by Michael Roth
Browse files

coroutine: Fix use after free with qemu_coroutine_yield()


Instead of using the same function for entering and exiting coroutines,
and hoping that it doesn't add any functionality that hurts with the
parameters used for exiting, we can just directly call into the real
task switch in qemu_coroutine_switch().

This fixes a use-after-free scenario where reentering a coroutine that
has yielded still accesses the old parent coroutine (which may have
meanwhile terminated) in the part of coroutine_swap() that follows
qemu_coroutine_switch().

Cc: qemu-stable@nongnu.org
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 80687b4dd6f43b3fef61fef8fbcb358457350562)
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent c4ca8af8
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,7 @@ void coroutine_fn qemu_coroutine_yield(void)
}
self->caller = NULL;
coroutine_swap(self, to);
qemu_coroutine_switch(self, to, COROUTINE_YIELD);
}
void qemu_coroutine_adjust_pool_size(int n)
......
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