Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2002 21:57:56 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        freebsd-hackers@freebsd.org
Subject:   how are sysctls in klds relocated?
Message-ID:  <15763.47908.220830.364584@grasshopper.cs.duke.edu>

next in thread | raw e-mail | index | archive | help

Can somebody explain to me how sysctls from klds are relocated?

For background, after the binutils upgrade in -stable, I'm unable to
load linux.ko on my desktop.  The faulting address is always
0x9010102464c457f (oidp->oid_parent) and the pc is in
sysctl_find_oid_name().

The crash looks like this:

acd0: CDROM <CD-ROM CDU4011> at ata1-slave PIO4
Mounting root from ufs:/dev/ad2a
linker_load_file: trying to load osf1 as elf64
linker_make_file: new file, filename=osf1.ko
linker_file_register_sysctls: registering SYSCTLs for osf1.ko
linker_file_register_sysctls: SYSCTLs 0
linker_file_sysinit: calling SYSINITs for osf1.ko
linker_file_sysinit: SYSINITs 0xfffffe00020799a0
linker_load_file: trying to load linux as elf64
linker_make_file: new file, filename=linux.ko
linker_file_register_sysctls: registering SYSCTLs for linux.ko
linker_file_register_sysctls: SYSCTLs 0xfffffe00020a6d08

fatal kernel trap:

    trap entry = 0x2 (memory management fault)
    a0         = 0x9010102464c457f
    a1         = 0x1
    a2         = 0x0
    pc         = 0xfffffc00003f42dc
    ra         = 0xfffffc00003f436c
    curproc    = 0xfffffe001557e980
        pid = 15, comm = kldload


#0  0xfffffc00003ed460 in dumpsys () at ../../kern/kern_shutdown.c:486
#1  0xfffffc00003ecfa8 in boot (howto=256) at
../../kern/kern_shutdown.c:316
#2  0xfffffc00003ed870 in panic (fmt=0xfffffc000061da1c "trap")
    at ../../kern/kern_shutdown.c:595
#3  0xfffffc00005ad4c0 in trap (a0=0x9010102464c457f,
a1=0xfffffe0019c49e30, a2=0, entry=2, framep=0xfffffe0019c49c20)
    at ../../alpha/alpha/trap.c:551
#4  0xfffffc000059f31c in XentMM ()
#5  0xfffffc00003f3f2c in sysctl_register_oid
(oidp=0xfffffe00020cc000)
    at ../../kern/kern_sysctl.c:102
<the rest from ddb, which actually works to get a stack trace..>
sysctl_find_oid_name()
sysctl_register_iod()
sysctl_register_set()
linker_file_register_sysctls()
linker_load_file()
kldload()
syscall()

(gdb) p *(struct linker_set *) 0xfffffe00020a6d08
$6 = {
  ls_length = 4, 
  ls_items = {0xfffffe0002080000}
}

(gdb) p/x *(struct sysctl_oid *)0xfffffe0002080000
$5 = {
  oid_parent = 0x9010102464c457f, 
  oid_link = {
    sle_next = 0x0
  }, 
  oid_number = 0x90260003, 
  oid_kind = 0x1, 
  oid_arg1 = 0x8d40, 
  oid_arg2 = 0x40, 
  oid_name = 0x18140, 
  oid_handler = 0x38004000000000, 
  oid_fmt = 0x1a001d00400003, 
  oid_refcnt = 0x1


From this, it appears that the contents of this linkerset are not
getting relocated.  How is that supposed to happen?

Interestingly enough, the value of oid_parent looks a hell of a lot
like offset 0 of the kld file, and the rest of the values seem to
match further offsets in the file:

% hd /modules/linux.ko 
00000000  7f 45 4c 46 02 01 01 09  00 00 00 00 00 00 00 00  |.ELF............|
00000010  03 00 26 90 01 00 00 00  00 8b 00 00 00 00 00 00  |..&.............|
00000020  40 00 00 00 00 00 00 00  d8 a1 12 00 00 00 00 00  |@...............|
00000030  00 00 00 00 40 00 38 00  03 00 40 00 1f 00 1c 00  |....@.8...@.....|
00000040  01 00 00 00 05 00 00 00  00 00 00 00 00 00 00 00  |................|
<...>

Does anybody have any idea WTF is happening here?   I'd like to figure
this out before 4.7-release..

Whats *really* odd (and annoying) is that I cannot reprduce this on my
crashbox.  The same binaries work fine on it ... this only happens on
my desktop.   

Thanks,

Drew

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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