Page MenuHomeFreeBSD

pf: Further initialize the inner TCP header in pf_test_state_icmp()
AcceptedPublic

Authored by markj on Fri, Mar 14, 12:39 AM.
Tags
None
Referenced Files
F112521075: D49347.diff
Wed, Mar 19, 6:43 AM
Unknown Object (File)
Mon, Mar 17, 10:20 AM
Unknown Object (File)
Fri, Mar 14, 9:36 AM
Unknown Object (File)
Fri, Mar 14, 4:32 AM
Unknown Object (File)
Fri, Mar 14, 3:02 AM

Details

Reviewers
kp
Summary

Otherwise the pointer &th.th_sum passed to pf_change_ap() points to
uninitialized memory, since the portion of the TCP header that we copy
from the packet doesn't include the initial checksum. This triggers a
KMSAN violation.

I believe the checksum value doesn't actually matter here, so it's safe
to initialize it to zero. That is, I don't think this is a real bug.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62908
Build 59792: arc lint + arc unit

Event Timeline

I see why KMSAN complains, and I agree that'd work to fix it, but I wonder if it wouldn't be better to pass a uint32_t dummy_pc to pf_change_ap() to make it more obvious that we're not manipulating the actual TCP checksum (which may or may not be there in the packet anyway).

This revision is now accepted and ready to land.Fri, Mar 14, 7:19 AM
In D49347#1125439, @kp wrote:

I see why KMSAN complains, and I agree that'd work to fix it, but I wonder if it wouldn't be better to pass a uint32_t dummy_pc to pf_change_ap() to make it more obvious that we're not manipulating the actual TCP checksum (which may or may not be there in the packet anyway).

That's certainly cleaner than what I did, will update.

Apply the suggestion of using a dummy checksum value instead.

This revision now requires review to proceed.Fri, Mar 14, 12:44 PM

The commit message needs tweaking to reflect this version.
That may already be in your local tree, because I believe git-arc doesn’t update the commit message.

This revision is now accepted and ready to land.Sat, Mar 15, 1:50 AM
In D49347#1125790, @kp wrote:

The commit message needs tweaking to reflect this version.
That may already be in your local tree, because I believe git-arc doesn’t update the commit message.

Pro-tip: if you change the header of the commit message in git and do exactly same change in the phabricator Web UI to revision title, git-arc would find it.