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
F107920205: D40708.id123632.diff
Sun, Jan 19, 11:02 AM
F107872697: D40708.id123632.diff
Sat, Jan 18, 9:47 PM
F107870879: D40708.id123686.diff
Sat, Jan 18, 9:29 PM
Unknown Object (File)
Sat, Jan 18, 1:11 AM
Unknown Object (File)
Sat, Jan 4, 1:28 AM
Unknown Object (File)
Wed, Jan 1, 5:34 AM
Unknown Object (File)
Dec 7 2024, 8:21 PM
Unknown Object (File)
Nov 20 2024, 1:10 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 52244
Build 49135: arc lint + arc unit