Page MenuHomeFreeBSD

epair: Fix panic on unload
ClosedPublic

Authored by kp on Oct 23 2017, 8:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 4:20 PM
Unknown Object (File)
Feb 16 2024, 4:19 PM
Unknown Object (File)
Dec 20 2023, 1:56 AM
Unknown Object (File)
Sep 13 2023, 9:27 AM
Unknown Object (File)
Sep 6 2023, 8:39 AM
Unknown Object (File)
Sep 6 2023, 8:38 AM
Unknown Object (File)
Sep 6 2023, 8:37 AM
Unknown Object (File)
Sep 1 2023, 6:07 AM
Subscribers

Details

Reviewers
bz
Group Reviewers
network
Commits
rS325283: epair: Fix panic on unload
Summary

The VNET_SYSUNINIT() callback is executed after the MOD_UNLOAD. That means
that netisr_unregister() has already been called when
netisr_unregister_vnet() gets calls, leading to an assertion failure.

Restore the expected order of operations by performing everything that
was done in MOD_UNLOAD to a SYSUNINIT() (that will be called after the
VNET_SYSUNINIT()).

Test Plan

Create an epair, hand one end to a vnet jail then unload the kernel module.
Previously it panicked as follows:

panic: netisr_unregister_vnet(8): protocol not registered for epair
cpuid = 4
time = 1508769842
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0469e9a650
vpanic() at vpanic+0x19c/frame 0xfffffe0469e9a6d0
kassert_panic() at kassert_panic+0x126/frame 0xfffffe0469e9a740
netisr_unregister_vnet() at netisr_unregister_vnet+0x237/frame 0xfffffe0469e9a7a0
vnet_epair_uninit() at vnet_epair_uninit+0x10/frame 0xfffffe0469e9a7b0
vnet_deregister_sysuninit() at vnet_deregister_sysuninit+0x7e/frame 0xfffffe0469e9a7e0
linker_file_unload() at linker_file_unload+0x53a/frame 0xfffffe0469e9a840
kern_kldunload() at kern_kldunload+0x10c/frame 0xfffffe0469e9a880
amd64_syscall() at amd64_syscall+0x79b/frame 0xfffffe0469e9a9b0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0469e9a9b0

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This is similar to how I fixed this problem for pf.

This is all highly unintuitive though, and it feels like the syuninits should be called before MOD_UNLOAD, but that's a larger change affecting *all* modules.

This revision was automatically updated to reflect the committed changes.