[Bug 267028] kernel panics when booting with both (zfs,ko or vboxnetflt,ko or acpi_wmi.ko) and amdgpu.ko

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 25 Dec 2024 01:44:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267028

--- Comment #294 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to George Mitchell from comment #292)

As it looks like those printf lines might be contributing to
problems of themselves, here is an alternate patch that
keeps history internally that I'd be able to examine via
the vmcore.*

Again: Only compile tested.

I doubt there is any reason to keep any kernel , kernel.debug ,
or vmcore.* that is based on the prior patch. Might as well
delete such to get the disk space back.

The below is based on the original, official code, not
on the prior patch.

# git -C /usr/alt-src diff sys/kern/kern_linker.c
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 5271d002fba4..fb5697ee5067 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1515,14 +1515,36 @@ modlist_lookup2(const char *name, const struct
mod_depend *verinfo)
        return (bestmod);
 }

+#define MODLIST_NEWMOD_HIST_SLOTS 256
+static struct modlist_newmod_hist_type {
+       modlist_t     modAddr;
+       linker_file_t containerAddr;
+       char const*   modnameAddr;
+       int           version;
+} modlist_newmod_hist[MODLIST_NEWMOD_HIST_SLOTS];
+static int modlist_newmod_hist_pos= MODLIST_NEWMOD_HIST_SLOTS; // First use
will wrap to 0 first.
+
 static modlist_t
 modlist_newmodule(const char *modname, int version, linker_file_t container)
 {
        modlist_t mod;

        mod = malloc(sizeof(struct modlist), M_LINKER, M_NOWAIT | M_ZERO);
+
+       ++modlist_newmod_hist_pos;
+       if (MODLIST_NEWMOD_HIST_SLOTS<=modlist_newmod_hist_pos)
modlist_newmod_hist_pos= 0;
+#undef MODLIST_NEWMOD_HIST_SLOTS
+       modlist_newmod_hist[modlist_newmod_hist_pos].modAddr=       mod;
+       modlist_newmod_hist[modlist_newmod_hist_pos].containerAddr= container;
+       modlist_newmod_hist[modlist_newmod_hist_pos].modnameAddr=   modname;
+       modlist_newmod_hist[modlist_newmod_hist_pos].version=       version;
+
        if (mod == NULL)
                panic("no memory for module list");
+
+       if (mod < (modlist_t)0xfffff80000000100)
+               panic("modlist_newmodule: mod <
(modlist_t)PHYS_TO_DMAP(0x100)");
+
        mod->container = container;
        mod->name = modname;
        mod->version = version;

-- 
You are receiving this mail because:
You are the assignee for the bug.