dma_buf_leak_4_threads ended in SIGABRT on the RTX 5080 Laptop GPU (NVIDIA 615.71.09, round job
m3-max-16620 at 600b535875). One of the two causes: once a test had failed and the process
exited, a device that dropped after the exit guard closed let go of its recorder slot, clearing
the slot's entry points, while a thread of that device's (the queue-switch check making its
objects) was still inside a section and recording through the slot. The slot's missing-command
thunk then panicked inside an extern "system" function, which aborts.
Every other path that lets go of a slot is the device's ordinary drop, which runs after the
device's threads stopped and so with no section of theirs live. Only an exit leaves sections
running past the slot's release: a section that started runs to its end. Slot::drop now enters
the exit guard; once the guard has closed it returns at once and leaves the slot as it is, with
its entry points stored and its index taken, just as the exit leaves the device to the process's
end.
Test: exit_guard::a_slot_let_go_of_while_the_process_exits_keeps_its_commands. A forked child
routes a stand-in device's functions through a slot and registers the hook. An exit handler that
runs after the hook drops the slot and records through it, and the child expects the stand-in to
be reached.
Verified: the test passes on CPU (potluck m3-max-16978) and in the RTX 3090 run (m3-max-16941).
It fails without the guard check (m3-max-17034, whose child aborts in the thunk).