Page MenuHomeFreeBSD

carp: Fix pullup checks
ClosedPublic

Authored by markj on Aug 30 2024, 4:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 2 2024, 10:55 PM
Unknown Object (File)
Nov 1 2024, 5:06 PM
Unknown Object (File)
Oct 24 2024, 11:37 AM
Unknown Object (File)
Oct 22 2024, 5:57 AM
Unknown Object (File)
Oct 22 2024, 5:56 AM
Unknown Object (File)
Oct 22 2024, 5:56 AM
Unknown Object (File)
Oct 22 2024, 5:56 AM
Unknown Object (File)
Oct 22 2024, 5:44 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.