Page MenuHomeFreeBSD

rip6_input() inp validation after epoch(9)
ClosedPublic

Authored by bz on Oct 17 2018, 8:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 1:08 AM
Unknown Object (File)
Oct 18 2024, 8:19 PM
Unknown Object (File)
Oct 18 2024, 8:19 PM
Unknown Object (File)
Oct 18 2024, 8:19 PM
Unknown Object (File)
Oct 18 2024, 7:56 PM
Unknown Object (File)
Sep 22 2024, 2:46 AM
Unknown Object (File)
Sep 11 2024, 5:53 PM
Unknown Object (File)
Sep 11 2024, 5:53 PM

Details

Summary

After r335924 rip6_input() needs inp validation to avoid
working on FREED inps.

Apply the relevant bits from r335497, r335501 (rip_input() change)
to the IPv6 counterpart.

PR: 232194

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Anyone? I'd love to get this in ...

rgrimes added a subscriber: rgrimes.
In D17594#377572, @bz wrote:

Anyone? I'd love to get this in ...

Are you targetting 12.0 by that statement?

This revision is now accepted and ready to land.Oct 23 2018, 10:50 PM
sys/netinet6/raw_ip6.c
299 ↗(On Diff #49247)

To protect that "last" is not used after-free, you need to move "INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et)" down to right before the return !?

Remember that the epoch section in this case only protects against freeing the item, and accessing "last" after exiting epoch means you likely will access a freed member.

sys/netinet6/raw_ip6.c
299 ↗(On Diff #49247)

I see that the RLOCK() will protect against freeing the item, because in_pcbfree_deferred() takes the WLOCK(). But it would be consider more smart to hold back the release of the epoch() so that in_pcbfree_deferred() doesn't hit a blocked lock?

The current patch is fine. Moving the epoch_exit() until the end of the function may be considered a future optimisation.

This revision was automatically updated to reflect the committed changes.