Page MenuHomeFreeBSD

pf: ensure mbufs are writable
ClosedPublic

Authored by kp on Sep 10 2024, 8:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 4:57 AM
Unknown Object (File)
Oct 1 2024, 9:47 PM
Unknown Object (File)
Sep 28 2024, 6:06 PM
Unknown Object (File)
Sep 24 2024, 9:27 AM
Unknown Object (File)
Sep 23 2024, 4:25 PM
Unknown Object (File)
Sep 23 2024, 2:27 PM
Unknown Object (File)
Sep 22 2024, 5:14 PM
Unknown Object (File)
Sep 21 2024, 12:31 PM

Details

Summary

Ensure that we can modify mbufs before we start processing them. There are a
number of paths where pf will m_copyback() or otherwise modify a packet. Ensure
that this is safe to do.

For example, ip6_forward() will m_copym() the packet before handing it to the
output pfil hook. This results in a non-writable mbuf, which would trigger
assertion failures (see previous commit).

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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

Event Timeline

kp requested review of this revision.Sep 10 2024, 8:20 PM
glebius added inline comments.
sys/netpfil/pf/pf.c
8418–8423

Not insisting on this style, but I would write it down this way.

This revision is now accepted and ready to land.Sep 11 2024, 1:57 AM
sys/netpfil/pf/pf.c
8418–8423

I'll include the __predict_false, because that's just clearly better.

I'll also change it to set m at the same time. It doesn't break anything if it's not there because we do set it again with the pull-up later, but we should be consistent about it.

I don't like that one-line construct though. Perhaps your brain is just larger than mine.

This revision was automatically updated to reflect the committed changes.