RE: random as module needs work

2001-03-13 Thread John Baldwin


On 13-Mar-01 Andrew Gallatin wrote:
> Gdb says:
> 
> (gdb) l* 0xfc42f824
> 0xfc42f824 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;

Perhaps static sysctls in modules are broken for some reason?  The sysctls were
all recently changed from dynamic to static.
 
> 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

This is a bug.  For kernel threads, we fork off of proc0, not curproc, so that
check in the alpha cpu_fork() is bogus.

> syncing disks... 
> done
> Uptime: 27s

-- 

John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: random as module needs work

2001-03-13 Thread Jake Burkholder

> 
> 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 = 0xfc42f824
> ra = 0xfc42f830
> curproc= 0xfe00058c24e0
> 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* 0xfc42f824
> 0xfc42f824 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message