kern/56897: kern_linker.c: prefversion != module's version causes panic

Ryuichiro Imura imura at ryu16.org
Mon Sep 15 10:30:17 PDT 2003


>Number:         56897
>Category:       kern
>Synopsis:       kern_linker.c: prefversion != module's version causes panic
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 15 10:30:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ryuichiro Imura
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD bluewind.xt.ryu16.org 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Tue Sep 16 02:05:33 JST 2003     root at bluewind.xt.ryu16.org:/usr/src/sys/i386/compile/BLUE  i386


>Description:

In kern_linker.c, "bestmod" is initialized as NULL in
modlist_lookup2(), "ver > bestmod->version" causes
system panic, when md_ver_preferred != the module's version.


>How-To-Repeat:

Edit one of prefversion in MODULE_DEPEND() in the tree, and load it.


>Fix:

I don't know the case that found_modules has two modules
these name are the same, I just remove "ver > bestmod->version"...

Index: kern_linker.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_linker.c,v
retrieving revision 1.107
diff -u -u -9 -r1.107 kern_linker.c
--- kern_linker.c	27 Jul 2003 17:04:55 -0000	1.107
+++ kern_linker.c	15 Sep 2003 17:08:24 -0000
@@ -1079,20 +1079,19 @@
 	bestmod = NULL;
 	for (mod = TAILQ_FIRST(&found_modules); mod;
 	    mod = TAILQ_NEXT(mod, link)) {
 		if (strcmp(mod->name, name) != 0)
 			continue;
 		ver = mod->version;
 		if (ver == verinfo->md_ver_preferred)
 			return (mod);
 		if (ver >= verinfo->md_ver_minimum &&
-		    ver <= verinfo->md_ver_maximum &&
-		    ver > bestmod->version)
+		    ver <= verinfo->md_ver_maximum)
 			bestmod = mod;
 	}
 	return (bestmod);
 }
 
 static modlist_t
 modlist_newmodule(const char *modname, int version, linker_file_t container)
 {
 	modlist_t mod;
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list