Move KHELP_DECLARE_MOD_UMA later in the boot

Both KHELP_DECLARE_MOD_UMA and the kernel linker SYSINIT to find
in-kernel modules run at SI_SUB_KLD, SI_ORDER_ANY. As the former
depends on the latter running first move it later in the boot,
to the new SI_SUB_KHELP. This ensures KHELP_DECLARE_MOD_UMA
module SYSINIT functions will be after the kernel linker.

Previously we may have received a panic similar to the following if
the order was incorrect:

panic: module_register_init: module named ertt not found

Reported by:	bob prohaska <fbsd AT www.zefox.net>
Discussed with:	imp, jhb
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Andrew Turner 2021-11-12 18:28:18 +00:00
parent 1817be481b
commit ae062ff269
2 changed files with 2 additions and 1 deletions

View File

@ -105,6 +105,7 @@ enum sysinit_sub_id {
SI_SUB_EVENTHANDLER = 0x1C00000, /* eventhandler init */
SI_SUB_VNET_PRELINK = 0x1E00000, /* vnet init before modules */
SI_SUB_KLD = 0x2000000, /* KLD and module setup */
SI_SUB_KHELP = 0x2080000, /* khelp modules */
SI_SUB_CPU = 0x2100000, /* CPU resource(s)*/
SI_SUB_RACCT = 0x2110000, /* resource accounting */
SI_SUB_KDTRACE = 0x2140000, /* Kernel dtrace hooks */

View File

@ -87,7 +87,7 @@ struct khelp_modevent_data {
.evhand = khelp_modevent, \
.priv = &kmd_##hname \
}; \
DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \
DECLARE_MODULE(hname, h_##hname, SI_SUB_KHELP, SI_ORDER_ANY); \
MODULE_VERSION(hname, version)
#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \