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
F131575598: D40708.id123686.diff
Thu, Oct 9, 10:21 AM
F131575592: D40708.id123632.diff
Thu, Oct 9, 10:21 AM
F131573372: D40708.diff
Thu, Oct 9, 9:48 AM
Unknown Object (File)
Sun, Oct 5, 4:56 PM
Unknown Object (File)
Thu, Sep 18, 12:29 AM
Unknown Object (File)
Sep 8 2025, 4:59 AM
Unknown Object (File)
Sep 7 2025, 10:51 PM
Unknown Object (File)
Aug 29 2025, 7: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