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
F55864662: D1977.diff
Sat, Feb 4, 8:16 PM
Unknown Object (File)
Nov 23 2016, 9:22 PM
Unknown Object (File)
Nov 15 2016, 11:40 AM
Unknown Object (File)
Nov 15 2016, 11:01 AM
Unknown Object (File)
Jun 27 2016, 11:47 PM
Unknown Object (File)
Feb 18 2016, 7:31 AM
Unknown Object (File)
Feb 17 2016, 7:16 AM
Unknown Object (File)
Jan 3 2016, 8:07 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!