Page MenuHomeFreeBSD

Use M_WRITABLE() rather than direct M_EXT checks
ClosedPublic

Authored by rwatson on Oct 4 2014, 10:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 12, 11:20 PM
Unknown Object (File)
Mon, Aug 12, 5:05 PM
Unknown Object (File)
Thu, Aug 8, 7:28 AM
Unknown Object (File)
Sun, Aug 4, 1:57 AM
Unknown Object (File)
Sun, Aug 4, 1:24 AM
Unknown Object (File)
Jul 10 2024, 2:22 AM
Unknown Object (File)
Jul 1 2024, 8:57 AM
Unknown Object (File)
Jun 30 2024, 9:07 AM
Subscribers
None

Details

Summary

Use M_WRITABLE() rather than checking explicitly (and only) for M_EXT in
cases where this was likely the intention (e.g., when deciding whether to
m_pullup() even if there is notionally sufficient data in the mbuf for a
read-write data structure). This reduces knowledge of extern-storage
mechanics outside of the mbuf allocator.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

rwatson retitled this revision from to Use M_WRITABLE() rather than direct M_EXT checks.
rwatson updated this object.
rwatson edited the test plan for this revision. (Show Details)
rwatson added reviewers: bz, glebius.
rwatson set the repository for this revision to rS FreeBSD src repository - subversion.
rwatson updated this revision to Diff 1892.

Closed by commit rS272559 (authored by @rwatson).

Sigh. Wrong URL in my commit message laid to premature closing of this patch.

bz requested changes to this revision.Oct 5 2014, 10:57 AM
bz edited edge metadata.

This is the wrong diff, right?

This revision now requires changes to proceed.Oct 5 2014, 10:57 AM

Argh, I see you committed with the wring D???? number and Phrabicator is too dumb. Can we make diff1 the default again?

Unfortunately, my ability to wield phabricator is weak. Maybe I should just create a new review request. I'll try resubmitting the original patch.

rwatson edited edge metadata.

Re-upload original diff following error in commit message with tricky consequences.

So let's see if I do understand the difference between m_pullup() and m_copyup() correctly.

sys/netinet/igmp.c
1469 ↗(On Diff #1895)

This logic doesn't entirely make sense to me. If the mbuf is not writeable how would you do a m_pullup() on it? You would need an m_copyup(), right? It wouldn't matter much in this code path to my understanding as we assume the mbuf to be gone (and no other copy being around) by the time we leave the function to my understanding.

The same applies to all other netinet/ files, ip6_mroute.c, and 2nd case in ip6_output.c.

Side question: is minlen actually smaller than MHLEN? I know this is unrelated ... so just assume that for the moment ;-)

sys/netinet6/icmp6.c
587 ↗(On Diff #1895)

Here it seems good.

sys/netinet6/ip6_output.c
1187 ↗(On Diff #1895)

M_TRAINLINGSPACE already does the M_WRITEABLE check for you. You can nuke it.

2910 ↗(On Diff #1895)

And that's another one of the m_pulls on possibly not writeable mbufs

rwatson updated this revision to Diff 1964.

Closed by commit rS272984 (authored by @rwatson).