Bug 214624 - [patch] [netgraph] [panic] fix kernel panic due to loading default netgraph modules into INVARIANTS-enabled kernel
Summary: [patch] [netgraph] [panic] fix kernel panic due to loading default netgraph m...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Eugene Grosbein
Keywords: patch
: 217712 (view as bug list)
Depends on:
Reported: 2016-11-18 12:37 UTC by Eugene Grosbein
Modified: 2019-02-07 20:51 UTC (History)
2 users (show)

See Also:

make NG_ABI_VERSION depend on options INVARIANTS (782 bytes, patch)
2016-11-18 12:37 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2016-11-18 12:37:58 UTC
Created attachment 177140 [details]
make NG_ABI_VERSION depend on options INVARIANTS

It is possible currently to load netgraph.ko and other NETGRAPH-related kernel modules built without INVARIANTS support into running kernel build with INVARIANS option. However, actual usage of such combination produces kernel panic:

panic: hashdestroy: hashtbl 0xc5ffc440 not empty (malloc type netgraph_node)
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper(c0a650f2,fffffff3,d,2dac00,63343430,...) at 0xc050580a = db_trace_self_wrapper+0x2a/frame 0xef4c17e8
kdb_backtrace(c0ab3b11,0,c0a64f71,ef4c18b4,0,...) at 0xc07702ed = kdb_backtrace+0x2d/frame 0xef4c1850
vpanic(c0a64f71,ef4c18b4,c0a64f71,ef4c18b4,ef4c18b4,...) at 0xc072e055 = vpanic+0x115/frame 0xef4c1884
kassert_panic(c0a64f71,c0a64f9b,c5ffc440,c630c296,c630d99c,...) at 0xc072df39 = kassert_panic+0xd9/frame 0xef4c18a8
hashdestroy(c5ffc440,c630d99c,f,1,f,...) at 0xc076f232 = hashdestroy+0x42/frame 0xef4c18d0
ng_make_node_common(c6414d5c,ef4c1940,531,c63f6080,c63d4358,...) at 0xc6304699 = ng_make_node_common+0x239/frame 0xef4c1900
ng_make_node(c63d4338,ef4c1940,0,0,0,...) at 0xc630437b = ng_make_node+0x8b/frame 0xef4c1920
ng_mkpeer(c63d4378,c63d4338,0,0,0,...) at 0xc63085df = ng_mkpeer+0x1f/frame 0xef4c1950
ng_apply_item(1,0,1,ef4c19c8,1,...) at 0xc6306a24 = ng_apply_item+0x484/frame 0xef4c19a8
ng_snd_item(c63f6080,0,c5f49260,0,ef4c1b98,...) at 0xc630636f = ng_snd_item+0x3ff/frame 0xef4c19d8
ngc_send(c62faa3c,0,c6337a00,c5f49350,0,...) at 0xc63e518a = ngc_send+0x23a/frame 0xef4c1a64
sosend_generic(c62faa3c,c5f49350,ef4c1b18,0,0,...) at 0xc07bc25b = sosend_generic+0x3eb/frame 0xef4c1ad8
kern_sendit(c6279350,5,ef4c1ba0,0,0,...) at 0xc07c2d7a = kern_sendit+0x29a/frame 0xef4c1b4c
sendit(ef4c1ba0,0,28828fb8,0,c5f49350,...) at 0xc07c30bf = sendit+0x19f/frame 0xef4c1b88
sys_sendto(c6279350,ef4c1c50,c0a58bb0,4,c627a000,...) at 0xc07c2f18 = sys_sendto+0x58/frame 0xef4c1bc0
syscall(ef4c1ce8) at 0xc09cc629 = syscall+0x399/frame 0xef4c1cdc
Xint0x80_syscall() at 0xc09b7efe = Xint0x80_syscall+0x2e/frame 0xef4c1cdc

Let's make NG_ABI_VERSION depend not on options NETGRAPH_DEBUG only, but on options INVARIANTS too. Attached patch does this.
Comment 1 Eugene Grosbein freebsd_committer 2017-09-19 17:16:10 UTC
My PR.
Comment 2 Andriy Voskoboinyk freebsd_committer 2019-02-07 20:51:06 UTC
*** Bug 217712 has been marked as a duplicate of this bug. ***