On Fri Oct 9, 2026 at 2:14 PM EDT, Daniel Zahka wrote:
How exactly are you injecting the completion? Just overwriting the id
field in the Rx completion with an arbitrary value from the driver?
Yes. No emulated fbnic, so this isn't from real hardware: on a KASAN
build I ran the completion handlers with FBNIC_RCD_AL_BUFF_PAGE_MASK set
out of range and saw the out-of-bounds access, which the patch removes.
Found by reading the code, not from a report.
The buffer id is chosen by SW when the BD is submitted to the device,
and the device just echoes it back like a cookie when that buffer is
used.
Agreed, a conforming device stays in range: fbnic_bd_prep() puts the
ring slot i, already masked to size_mask in fbnic_fill_bdq(), into
FBNIC_BD_PAGE_ID_MASK, and rx_buf[i] is that slot, so every id the
driver hands out is in range by construction.
The completion path is the one place that takes the id back and uses it
as the rx_buf[] subscript without bounding it. A device that returns an
id it was never given then gets an out-of-bounds pagecnt_bias decrement
and an out-of-bounds netmem dereference: a device-triggered memory
safety bug, just not one a conforming device reaches. The patch bounds
the index and drops the frame for one comparison per completion.