From owner-freebsd-current Tue Mar 13 14:22:54 2001 Delivered-To: freebsd-current@freebsd.org Received: from cr66388-a.rchrd1.on.wave.home.com (cr66388-a.rchrd1.on.wave.home.com [24.114.165.24]) by hub.freebsd.org (Postfix) with ESMTP id 518A837B718 for ; Tue, 13 Mar 2001 14:22:49 -0800 (PST) (envelope-from jburkholder0829@home.com) Received: from cr66388-a.rchrd1.on.wave.home.c (localhost [127.0.0.1]) by cr66388-a.rchrd1.on.wave.home.com (Postfix) with ESMTP id CC03EBA69; Tue, 13 Mar 2001 17:22:48 -0500 (EST) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Andrew Gallatin Cc: current@FreeBSD.ORG Subject: Re: random as module needs work In-Reply-To: Message from Andrew Gallatin of "Tue, 13 Mar 2001 15:14:13 EST." <15022.32661.564910.735073@grasshopper.cs.duke.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 13 Mar 2001 17:22:48 -0500 From: Jake Burkholder Message-Id: <20010313222248.CC03EBA69@cr66388-a.rchrd1.on.wave.home.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I built a kernel without the random device and tried to use the > module. I loaded it from the bootloader and the machine panic'ed on boot: > > Mounting root from ufs:/dev/da0a > da0 at sym0 bus 0 target 0 lun 0 > da0: Fixed Direct Access SCSI-2 device > da0: 40.000MB/s transfers (20.000MHz, offset 15, 16bit), Tagged Queueing Enabled > da0: 8683MB (17783240 512 byte sectors: 255H 63S/T 1106C) > Entropy harvesti > fatal kernel trap: > > trap entry = 0x2 (memory management fault) > a0 = 0xe8c77a27c5265710 > a1 = 0x1 > a2 = 0x0 > pc = 0xfffffc000042f824 > ra = 0xfffffc000042f830 > curproc = 0xfffffe00058c24e0 > pid = 34, comm = sysctl > > Stopped at name2oid+0x104: ldq a1,0x28(s1) <0xe8c77a27c5265710> > > name2oid() at name2oid+0x104 > sysctl_sysctl_name2oid() at sysctl_sysctl_name2oid+0xd0 > sysctl_root() at sysctl_root+0x16c > userland_sysctl() at userland_sysctl+0x1c0 > __sysctl() at __sysctl+0xa4 > syscall() at syscall+0x638 > XentSys1() at XentSys1+0x10 > db> reboot Don't know what's happening here. > > Gdb says: > > (gdb) l* 0xfffffc000042f824 > 0xfffffc000042f824 is in name2oid (../../kern/kern_sysctl.c:621). > 616 *p = '\0'; > 617 > 618 oidp = SLIST_FIRST(lsp); > 619 > 620 while (oidp && *len < CTL_MAXNAME) { > 621 if (strcmp(name, oidp->oid_name)) { > 622 oidp = SLIST_NEXT(oidp, oid_link); > 623 continue; > 624 } > 625 *oid++ = oidp->oid_number; > > > When I boot into single user mode and try to load the module after boot, this happens: > Enter full pathname of shell or RETURN for /bin/sh: > # kldload random > panic: cpu_fork: curproc > > syncing disks... > done > Uptime: 27s I'm fairly certain this is an invalid assertion: #ifdef DIAGNOSTIC if (p1 != curproc) panic("cpu_fork: curproc"); ... kthread_create forks the new thread on behalf of proc0, error = fork1(&proc0, ... but if you loaded the module from single user mode then curproc is most likely going to initproc and not &proc0. Basically this doesn't allow an arbitrary process to create a kernel thread. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message