Summary
monad_event_ring_try_copy copies a descriptor into the caller-provided output buffer before
checking whether the sequence number is valid.
Vulnerability details
inline bool monad_event_ring_try_copy( struct monad_event_ring const *event_ring, uint64_t seqno, struct monad_event_descriptor *event){ if (__builtin_expect(seqno == 0, 0)) { return false; } struct monad_event_descriptor const *const ring_event = &event_ring->descriptors[(seqno - 1) & event_ring->desc_capacity_mask]; *event = *ring_event; uint64_t const ring_seqno = __atomic_load_n(&ring_event->seqno, __ATOMIC_ACQUIRE); if (__builtin_expect(ring_seqno != seqno, 0)) { return false; } return true;}Impact
When validation fails and the function returns false, the output buffer can still contain stale
descriptor metadata from an unrelated event.
Recommendation
Validate the sequence number first, then copy the descriptor only on success.