Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2003 02:25:30 +0900 (JST)
From:      Ryuichiro Imura <imura@ryu16.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/56897: kern_linker.c: prefversion != module's version causes panic
Message-ID:  <200309151725.h8FHPUYE052935@redeye.xt.ryu16.org>
Resent-Message-ID: <200309151730.h8FHUFBe030654@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309151725.h8FHPUYE052935>