From owner-freebsd-bugs Tue Oct 20 10:20:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA09818 for freebsd-bugs-outgoing; Tue, 20 Oct 1998 10:20:08 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA09809 for ; Tue, 20 Oct 1998 10:20:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id KAA29745; Tue, 20 Oct 1998 10:20:00 -0700 (PDT) Received: from eubie.lbl.gov (eubie.lbl.gov [131.243.2.36]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA09524 for ; Tue, 20 Oct 1998 10:15:32 -0700 (PDT) (envelope-from jin@eubie.lbl.gov) Received: (from jin@localhost) by eubie.lbl.gov (8.9.1/8.9.1) id KAA00422; Tue, 20 Oct 1998 10:15:06 -0700 (PDT) (envelope-from jin) Message-Id: <199810201715.KAA00422@eubie.lbl.gov> Date: Tue, 20 Oct 1998 10:15:06 -0700 (PDT) From: Jin Guojun (FTG staff) Reply-To: jin@eubie.lbl.gov To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/8386: modload failure Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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