Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2001 17:22:48 -0500
From:      Jake Burkholder <jburkholder0829@home.com>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        current@FreeBSD.ORG
Subject:   Re: random as module needs work 
Message-ID:  <20010313222248.CC03EBA69@cr66388-a.rchrd1.on.wave.home.com>
In-Reply-To: Message from Andrew Gallatin <gallatin@cs.duke.edu>  of "Tue, 13 Mar 2001 15:14:13 EST." <15022.32661.564910.735073@grasshopper.cs.duke.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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: <SEAGATE ST39140W 1498> 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




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