Date: Tue, 20 Oct 1998 10:15:06 -0700 (PDT) From: Jin Guojun (FTG staff) <jin@eubie.lbl.gov> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/8386: modload failure Message-ID: <199810201715.KAA00422@eubie.lbl.gov>
next in thread | raw e-mail | index | archive | help
>Number: 8386 >Category: kern >Synopsis: modload failure >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 20 10:20:00 PDT 1998 >Last-Modified: >Originator: Jin Guojun (FTG staff) >Organization: >Release: FreeBSD 3.0-19981015-BETA i386 >Environment: currently test under 3.0-19981015-BETA, last one prior to 3.0-RELEASE >Description: code segment in modload.c /* * Transfer the relinked module to kernel memory in chunks of * MODIOBUF size at a time. */ for (bytesleft = info_buf.a_text + info_buf.a_data; bytesleft > 0; bytesleft -= sz) { sz = min(bytesleft, MODIOBUF); read(modfd, buf, sz); ldbuf.cnt = sz; ldbuf.data = buf; if (ioctl(devfd, LMLOADBUF, &ldbuf) == -1) err(11, "error transferring buffer"); } /* * Save ourselves before disaster (potentitally) strikes... */ sync(); /* * Trigger the module as loaded by calling the entry procedure; * this will do all necessary table fixup to ensure that state * is maintained on success, or blow everything back to ground * zero on failure. */ if (ioctl(devfd, LMREADY, &modentry) == -1) /* failed HERE */ err(14, "error initializing module"); /* exited HERE */ DEBUG output from kern_lkm.c ... (repeating lines omitted) LKM: LMLOADBUF (loading @ 285184 of 329868, i = 512) 2 LKM: LMLOADBUF (loading @ 285696 of 329868, i = 512) 2 LKM: LMLOADBUF (loading @ 286208 of 329868, i = 512) 2 lkm_state is 00 LKM: LMUNRESERV ------------ As we see LMLOADBUF is lkm_state=2, and the "for loop " for the ioctl(devfd, LMLOADBUF, &ldbuf) was successfully finished. After sync(), somehow, lkm_state became 00 which causes kern_lkm return ENXIO (Device not configured) and let modload exit at the last two line printed above. There is no other code between these two segments except sync(). Could sync() zeros out the local variable "lkm_state"? What could happen here? >How-To-Repeat: compile kernel with "make DEBUG=-D_DEBUG" or modified Makefile to add DEBUG=-DDEBUG line, then install the kernel and reboot. Testing modload anything to see the output. >Fix: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810201715.KAA00422>