Page MenuHomeFreeBSD

Fix unlocked access to ifnet address list
ClosedPublic

Authored by rstone on Jul 17 2016, 6:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 12:37 AM
Unknown Object (File)
Sat, Nov 9, 5:48 AM
Unknown Object (File)
Thu, Nov 7, 2:50 PM
Unknown Object (File)
Tue, Nov 5, 1:25 PM
Unknown Object (File)
Oct 15 2024, 11:15 AM
Unknown Object (File)
Oct 15 2024, 11:15 AM
Unknown Object (File)
Oct 14 2024, 11:01 AM
Unknown Object (File)
Oct 14 2024, 6:35 AM
Subscribers

Details

Summary

in_broadcast() was iterator over the ifnet address list without
first taking an if_addr_rlock. This could cause a panic if a
concurrent operation modified the list.

Test Plan

Added and removed IPs in a loop on an ifnet while traffic was actively
running on it.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4544
Build 4596: arc lint + arc unit

Event Timeline

rstone retitled this revision from to Fix unlocked access to ifnet address list.
rstone updated this object.
rstone edited the test plan for this revision. (Show Details)
bz requested changes to this revision.Jul 17 2016, 6:52 PM
bz added a reviewer: bz.
bz added a subscriber: bz.

If I am not mistaken the function calls are for modules (especially 3rd party) while we should use the macros in the kernel (unless I misremember something here)?

This revision now requires changes to proceed.Jul 17 2016, 6:52 PM
rstone edited edge metadata.

Use macros for code compiled in kernel

so apparently this is called on nearly every packet that passes through ip_output() (according to a comparison of dtrace and netstat output). Adding an additional lock/unlock to the transmit path concerns me, but this is obviously the right fix. Does in_broadcast() really need to be called so much?

This revision was automatically updated to reflect the committed changes.