Page MenuHomeFreeBSD

Protect calls to mtod() from accessing NULL mbufs
ClosedPublic

Authored by gnn on Jan 3 2017, 8:36 PM.

Details

Summary
Test Plan

Trace all debug output using a modified tcpdebug script that looks at all sockets

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gnn retitled this revision from to Protect calls to mtod() from accessing NULL mbufs.Jan 3 2017, 8:36 PM
gnn updated this object.
gnn edited the test plan for this revision. (Show Details)
gnn added a reviewer: hiren.
gnn updated this revision to Diff 23585.
hiren edited edge metadata.Jan 3 2017, 8:58 PM

Is it possible to handle 'm' being null in TCP_PROBE3() instead of these if/else checks everywhere?

hiren updated this object.Jan 3 2017, 8:58 PM
hiren edited edge metadata.
hiren added a subscriber: avg.
gnn added a comment.Jan 3 2017, 9:00 PM

I could make an uglier macro. If that would please the audience.

hiren added a comment.Jan 3 2017, 9:02 PM
In D9035#186666, @gnn wrote:

I could make an uglier macro. If that would please the audience.

Hah. Uglier macro in one place might probably be better?

I'll see what others have to say. :-)

mjg added a subscriber: mjg.Jan 3 2017, 11:46 PM

Have you checked generated assembly? This likely executes a branch regardless of whether SDT is enabled. On the other putting the check in the macro should get around that.

gnn updated this revision to Diff 23589.Jan 4 2017, 1:44 AM

We actually don't need mtod() at all. If you want the mbuf, use the mbuf provider.

hiren edited edge metadata.Jan 4 2017, 2:11 AM
hiren accepted this revision.
This revision is now accepted and ready to land.Jan 4 2017, 2:11 AM
This revision was automatically updated to reflect the committed changes.