Hi Peter,

Thanks for confirming the problem and for the simpler suggestion.

I tried your version of the fix (remove the fd handler after
qemu_coroutine_yield() returns, instead of inside fd_coroutine_enter())
on top of qemu master e9fa1f66f0d4 and ran the existing tests:

  - tests/unit/test-coroutine: 13/13 passed
  - tests/unit/test-aio:      27/27 passed

Both the normal fd path and the re-entry path remove the handler exactly
once, and the stack-allocated FDYieldUntilData is no longer referenced by
a stale handler.

The analysis that led here (fd handler registered on a stack object and
re-entered through a path that bypasses fd_coroutine_enter()) came from
our in-house static analysis tool, so I am glad it matches a real issue
you had already seen.

Best regards,
Hongyan

Reply via email to