From owner-freebsd-hackers Thu Sep 26 18:58:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59BC737B401 for ; Thu, 26 Sep 2002 18:58:27 -0700 (PDT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id C38A543E7B for ; Thu, 26 Sep 2002 18:58:26 -0700 (PDT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id VAA08723 for ; Thu, 26 Sep 2002 21:58:26 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id g8R1vuB00881; Thu, 26 Sep 2002 21:57:56 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15763.47908.220830.364584@grasshopper.cs.duke.edu> Date: Thu, 26 Sep 2002 21:57:56 -0400 (EDT) To: freebsd-hackers@freebsd.org Subject: how are sysctls in klds relocated? X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 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