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)
Mon, Nov 4, 8:21 AM
Unknown Object (File)
Oct 9 2024, 11:02 AM
Unknown Object (File)
Oct 1 2024, 3:54 AM
Unknown Object (File)
Sep 24 2024, 5:21 AM
Unknown Object (File)
Sep 23 2024, 8:17 PM
Unknown Object (File)
Sep 21 2024, 11:49 PM
Unknown Object (File)
Sep 16 2024, 8:21 PM
Unknown Object (File)
Sep 15 2024, 1:23 AM
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