Page MenuHomeFreeBSD

carp: Fix pullup checks
ClosedPublic

Authored by markj on Aug 30 2024, 4:59 PM.
Tags
None
Referenced Files
F97496670: D46492.diff
Sun, Sep 29, 5:47 PM
Unknown Object (File)
Fri, Sep 27, 5:38 AM
Unknown Object (File)
Mon, Sep 23, 6:30 AM
Unknown Object (File)
Mon, Sep 9, 11:25 PM
Unknown Object (File)
Sun, Sep 8, 8:18 AM
Unknown Object (File)
Tue, Sep 3, 5:37 PM
Unknown Object (File)
Mon, Sep 2, 11:03 AM
Unknown Object (File)
Mon, Sep 2, 4:02 AM

Details

Summary

The conditions used to test whether a pullup is needed were inverted.

While here:

  • Fix a bogus assignment to "iplen": it's already initialized to *offp.
  • Use in_cksum_skip() instead of manually adjusting the data pointer. Otherwise the mbuf is temporarily in an invalid state, since m_len isn't updated to match.

Reported by: KMSAN
Sponsored by: Klara, Inc.
Fixes: 37115154672f ("carp: support VRRPv3")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Aug 30 2024, 4:59 PM

Use in_cksum_skip() in carp6_input() as well.

This revision is now accepted and ready to land.Aug 30 2024, 7:55 PM
sys/netinet/ip_carp.c
597

This and the other in_cksum_skip() call is wrong. in_cksum_skip() has a weird interface: the offset should be included in the length, so we always have len >= off, and the function checksums len - off bytes.

Currently waiting for a test run to finish with this call changed to in_cksum_skip(m, totlen, iplen) and the one below changed to in_cksum_skip(m, sizeof(struct carp_header) + *offp, *offp).

This revision was automatically updated to reflect the committed changes.