panic booting with if_tap_load="YES" in loader.conf
Mark Johnston
markj at freebsd.org
Sat May 18 05:33:37 UTC 2019
On Fri, May 17, 2019 at 10:18:57PM -0600, Rebecca Cran wrote:
> I just updated from r346856 to r347950 and ran into a new panic, caused
> by having if_tap_load="YES" in /boot/loader.conf - because it's already
> built-in to the kernel:
I think this patch should fix the panic, but I only compile-tested it.
I considered having the logic live in preload_delete_name() instead, but
the boot-time ucode code must still defer the deletion somewhat.
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 6ceb34d66b74..10b28d5d375c 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -1179,11 +1179,41 @@ link_elf_unload_file(linker_file_t file)
free(ef->typoff, M_LINKER);
}
+struct pending_unload {
+ char pathname[MAXPATHLEN];
+ SLIST_ENTRY(pending_unload) next;
+};
+SLIST_HEAD(, pending_unload) pending = SLIST_HEAD_INITIALIZER(pending);
+
static void
-link_elf_unload_preload(linker_file_t file)
+link_elf_unload_pending(void *arg __unused)
{
- if (file->pathname != NULL)
+ struct pending_unload *file;
+
+ while ((file = SLIST_FIRST(&pending)) != NULL) {
preload_delete_name(file->pathname);
+ SLIST_REMOVE_HEAD(&pending, next);
+ free(file, M_LINKER);
+ }
+}
+SYSINIT(unload_pending, SI_SUB_CONFIGURE + 1, SI_ORDER_ANY,
+ link_elf_unload_pending, NULL);
+
+static void
+link_elf_unload_preload(linker_file_t lf)
+{
+ struct pending_unload *file;
+
+ if (lf->pathname != NULL) {
+ if (!cold) {
+ preload_delete_name(lf->pathname);
+ return;
+ }
+ file = malloc(sizeof(*file), M_LINKER, M_WAITOK);
+ (void)strlcpy(file->pathname, lf->pathname,
+ sizeof(file->pathname));
+ SLIST_INSERT_HEAD(&pending, file, next);
+ }
}
static const char *
More information about the freebsd-current
mailing list