Page MenuHomeFreeBSD

dummynet: fix ip_dn_vnet_init() / dummynet_task() race
AbandonedPublic

Authored by kp on Jul 4 2022, 9:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 23, 10:01 PM
Unknown Object (File)
Sep 21 2024, 10:42 PM
Unknown Object (File)
Sep 17 2024, 10:34 PM
Unknown Object (File)
Sep 8 2024, 3:32 PM
Unknown Object (File)
Sep 8 2024, 5:54 AM
Unknown Object (File)
Sep 7 2024, 3:27 PM
Unknown Object (File)
Aug 28 2024, 2:49 PM
Unknown Object (File)
Jul 6 2024, 2:59 PM

Details

Summary

If dummynet_task() is run on a vnet where dummynet is still initialising
(i.e. still running ip_dn_vnet_init()) we can attempt to use an
uninitialised mutex.

We can use the existing init_done field to check if the per-vnet
V_dn_cfg is fully set up, if we ensure that it's only set to 1 when
we've done all of the init work.

Reported by: Alfredo Dal'Ava Júnior <alfredo@freebsd.org>
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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

Event Timeline

kp requested review of this revision.Jul 4 2022, 9:08 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 5 2022, 5:56 PM
This revision was automatically updated to reflect the committed changes.

This commit breaks non-VIMAGE kernel build. Try MINIMAL kernel for example.

/usr/src/sys/netpfil/ipfw/ip_dn_io.c:674:4: error: 'continue' statement not in loop statement
                        continue;
                        ^
1 error generated.
In D35716#810455, @jkim wrote:

This commit breaks non-VIMAGE kernel build. Try MINIMAL kernel for example.

/usr/src/sys/netpfil/ipfw/ip_dn_io.c:674:4: error: 'continue' statement not in loop statement
                        continue;
                        ^
1 error generated.

I'm aware and am testing a fix (to the vnet macros).