netmap: harden nmreq option size and overflow checks (defensive)#265
netmap: harden nmreq option size and overflow checks (defensive)#265SORencber wants to merge 1 commit intoopnsense:stable/25.7from
Conversation
…ct option body size equality per option type\n- Add explicit overflow guards to size arithmetic (sum)\n- Return EINVAL for invalid sizes; keep behavior for valid requests\n- Defensive hardening; no API break; reduces potential DoS/OOB surfaces
|
hi @SORencber best open a request upstream (https://github.com/freebsd/freebsd-src / https://reviews.freebsd.org/) to avoid future breakage. |
|
Thanks for the guidance. I’ve submitted the defensive hardening upstream to FreeBSD (link to Differential on reviews.freebsd.org). Keeping this PR open until upstream is accepted, then we can align in OPNsense. No API change; single-file change in sys/dev/netmap/netmap.c |
|
Submitted upstream |
Summary: Enforce exact per‑option body size equality; add explicit overflow guards for size arithmetic; reject invalid lengths with EINVAL. Defensive hardening; no API break.
Test Plan: malformed NIOCCTRL (oversized nro_size, invalid types) → EINVAL/ENOTTY/ENXIO; no panic; valid flows unchanged.
Risk: Low; only invalid inputs are rejected earlier.