microsoft / microsoft/ebpf-for-windows
Address the CoPilot Issues mentioned in #5229
- Dominant language
- C
- Stars
- 3.6k
- Forks
- 311
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 21
Description
1. In ebpf_free_ring_buffer_memory(), if ring->user_process is still set it implies the ring is still mapped into user-mode (user_consumer_address/user_producer_address are non-NULL). Dereferencing the process and then freeing the user MDLs without first unmapping the user pages can leave stale user-mode mappings and may violate the expected MmUnmapLockedPages-before-IoFreeMdl lifetime, risking leaks or crashes. Consider unmapping using the stored user addresses (and, if needed, attaching to ring->user_process) before freeing the MDLs, or failing fast/asserting if this state should be impossible.
2. The Doxygen block for ebpf_ring_buffer_unmap_user() has a duplicated @param[in] ring_buffer line, which can confuse generated docs and readers. Remove the duplicate parameter description so each parameter is documented once.
3. ebpf_ring_buffer_map_unmap_buffer_with_index() now treats consumer/producer/data as optional and the implementation ignores them, but the header comment still describes them as required pointers to the mapped buffers. Update the API comment to reflect that these parameters may be null/are no longer used by the unmap IOCTL (the kernel unmaps using internally stored addresses), to avoid misleading future callers.
Contributor guide
Assessment
This issue has not been assessed yet.