fix(lib): detach the received packet before handing it to a vtask (bug-1916)
vtask_handle_msg published the VTASK_IO task while ep->fsm_in.pkt still pointed at the packet; INVOKE_MSG_HANDLER clears the slot only after the handler returns. A vtask could decode and free the packet (xce_decode) and wake the client, whose failover reconnect then ran endpoint_fini and freed the dangling slot again: ASAN heap-use-after-free in free_packet, seen in the worker and scheduler during failovers under heavy CPU load. vtask_handle_msg now clears ep->fsm_in.pkt before vtask_enq and marks the task the packet's sole owner (owns_io_pkt), so never-run tasks free it at vtaskmgr_fini and an enqueue failure frees it instead of leaking; xcectx vtask_entry frees it on its early -EINVAL exits. Same take-and- clear discipline the controller's peer-control path already used. Tests: test_vtask_pkt_handoff.c (3), RED reproduces the soak's ASAN stack. libxce 733/0; xce-build all green; loaded /xce-test-ha soak (8 rounds, 40 spinners) PASS with no ASAN reports (it crashed 2/2 before). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2aefa939db
commit
0fb2e14cc7
6 changed files with 257 additions and 17 deletions
|
|
@ -229,6 +229,7 @@ libxce_test_src = ['testsuite/test.c',
|
|||
'testsuite/test_ctrlstatus.c',
|
||||
'testsuite/test_vtask_admission.c',
|
||||
'testsuite/test_vtask_enq_race.c',
|
||||
'testsuite/test_vtask_pkt_handoff.c',
|
||||
'testsuite/test_vtask_order.c',
|
||||
'testsuite/test_vtaskmgr_teardown.c',
|
||||
'testsuite/test_xcealloc.c',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue