iflib: Fix panic when netmap VALE drops packets to iflib driver#2264
Open
TeddyEngel wants to merge 1 commit into
Open
iflib: Fix panic when netmap VALE drops packets to iflib driver#2264TeddyEngel wants to merge 1 commit into
TeddyEngel wants to merge 1 commit into
Conversation
Contributor
Author
|
CI failures seem unrelated to this PR - they're in lib/libc/gen/getcap.c (conflicting types for cgetent/cgetfirst/cgetnext). Same failures also appeared on PR #2263. Style Checker and commit checks pass. |
PR: 294726 Signed-off-by: Teddy Engel <engel.teddy@gmail.com>
516c025 to
e1aabd5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a netmap VALE switch drops packets destined for an iflib-based network driver (e.g., vmxnet3, igb, em), the kernel panics with a page fault in the driver's
isc_txd_encap()function.The crash occurs because:
nm_vale_flush()drops oversized packets by settingslot->len = 0iflib_netmap_txsync()processes the zero-length slot butseg_idxstays 0 sincelen == 0isc_txd_encap()is called withpi->ipi_nsegs = 0To fix, we skip zero-length packets (
seg_idx == 0) at end-of-packet. Advancenm_ito consume the netmap slot but notnic_i, avoiding gaps in the NIC descriptor ring.The fix is in iflib rather than individual drivers because all iflib drivers assume
nsegs > 0, and we want to protect all drivers with a single fix.Tested on FreeBSD 16.0-CURRENT using the reproducer script from the bug report.
PR: 294726