Page MenuHomeFreeBSD

wg: fix a number of issues with module load failure handling
ClosedPublic

Authored by kevans on Jun 21 2023, 7:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 21, 3:54 AM
Unknown Object (File)
Tue, Apr 21, 12:41 AM
Unknown Object (File)
Wed, Apr 15, 10:00 AM
Unknown Object (File)
Mon, Apr 13, 7:31 PM
Unknown Object (File)
Sun, Apr 12, 9:31 PM
Unknown Object (File)
Sat, Apr 11, 5:09 PM
Unknown Object (File)
Tue, Apr 7, 1:32 AM
Unknown Object (File)
Mon, Apr 6, 4:14 PM
Subscribers

Details

Summary

If MOD_LOAD fails, then MOD_UNLOAD will be called to unwind module
state, but wg_module_init() will have already deinitialized everything
it needs to in a manner that renders it unsafe to call MOD_UNLOAD
after (e.g., freed zone not reset to NULL, wg_osd_jail_slot not reset
to 0). Let's simply stop trying to handle freeing everything in
wg_module_init() to simplify it; let the subsequent MOD_UNLOAD deal with
it, and let's make that robust against partially-constructed state.

While we're here, fix MOD_LOAD to fail if cookie_init() fails;
previously we would hop to the free_crypto label and never set ret to
a proper errno from the 0 it maintained from the previous crypto_init().

PR: 272089

Diff Detail

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