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.
gnn updated this object.
gnn edited the test plan for this revision. (Show Details)
gnn added a reviewer: hiren.

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

hiren edited edge metadata.
hiren added a subscriber: avg.

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

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. :-)

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.

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

hiren edited edge metadata.
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.