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)
Feb 22 2024, 5:51 AM
Unknown Object (File)
Dec 20 2023, 1:25 AM
Unknown Object (File)
Dec 16 2023, 10:38 AM
Unknown Object (File)
Dec 7 2023, 5:10 AM
Unknown Object (File)
Nov 12 2023, 5:44 AM
Unknown Object (File)
Aug 22 2023, 4:36 AM
Unknown Object (File)
Jul 29 2023, 5:46 PM
Unknown Object (File)
May 7 2023, 5:51 PM
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!