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)
Sat, Dec 7, 8:21 PM
Unknown Object (File)
Nov 20 2024, 1:10 AM
Unknown Object (File)
Nov 19 2024, 11:30 PM
Unknown Object (File)
Nov 4 2024, 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
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