Page MenuHomeFreeBSD

Pad RX copy alignment calculation to avoid illegal memory accesses when copying custom mbuf structures
ClosedPublic

Authored by ngie on Feb 27 2015, 4:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 12:00 AM
Unknown Object (File)
Oct 4 2024, 11:44 PM
Unknown Object (File)
Oct 2 2024, 8:59 AM
Unknown Object (File)
Oct 2 2024, 6:00 AM
Unknown Object (File)
Sep 30 2024, 11:40 AM
Unknown Object (File)
Sep 30 2024, 5:04 AM
Unknown Object (File)
Sep 27 2024, 1:16 AM
Unknown Object (File)
Sep 24 2024, 5:27 AM
Subscribers

Details

Reviewers
jfv
erj
Summary

Pad RX copy alignment calculation to avoid illegal memory accesses

The optimization made in r239940 is valid for struct mbuf's current structure
and size in FreeBSD, but hardcodes assumptions about sizes of struct mbuf

PR: 194314
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

Test Plan

Preconditions:

  • System must have an ixgbe interface
  • System must be on a network with a DHCP server
  • Adjust struct mbuf (add dummy int * values in the header field).
  • Rebuild the kernel and build ixgbe as a module, not statically compiled into the kernel
  • Boot system with custom kernel into singleuser mode
  • Press <Enter>
  • kldload ixgbe
  • dhclient ix0

Expected results:

  • The interface should be brought up
  • An IP address should be assigned to the interface

Actual results:
The dhclient ix0 call would deterministically panic the system with page faults
in the ixgbe code

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ngie retitled this revision from to Pad RX copy alignment calculation to avoid illegal memory accesses when copying custom mbuf structures.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added reviewers: erj, jfv.
ngie added a subscriber: adrian.
ngie retitled this revision from Pad RX copy alignment calculation to avoid illegal memory accesses when copying custom mbuf structures to Pad RX copy alignment calculation to avoid illegal memory accesses when copying custom mbuf structures.Feb 27 2015, 4:34 AM
ngie updated this object.
ngie added a subscriber: benno.
jfv edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Feb 27 2015, 6:09 PM
erj edited edge metadata.

I'd like an #ifndef MPKTHSIZE block to define what MPKTHSIZE is for pre-11 FreeBSD versions, just in case someone takes this driver to use on 10.1; but as it is I think it's good. I tried the sample application you posted in the PR on 10.1 amd64, 11 amd64, and 11 i386 and I didn't get any asserts.

Fix committed in r279393 -- thank you!