From owner-cvs-all Fri Aug 10 16:36:44 2001 Delivered-To: cvs-all@freebsd.org Received: from green.bikeshed.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id BC79637B401; Fri, 10 Aug 2001 16:36:34 -0700 (PDT) (envelope-from green@green.bikeshed.org) Received: from localhost (green@localhost) by green.bikeshed.org (8.11.4/8.11.1) with ESMTP id f7ANaUQ85691; Fri, 10 Aug 2001 19:36:34 -0400 (EDT) (envelope-from green@green.bikeshed.org) Message-Id: <200108102336.f7ANaUQ85691@green.bikeshed.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Bill Paul Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern link_elf.c In-Reply-To: Message from Bill Paul of "Fri, 10 Aug 2001 16:15:13 PDT." <200108102315.f7ANFD257971@freefall.freebsd.org> From: "Brian F. Feldman" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 10 Aug 2001 19:36:29 -0400 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bill Paul wrote: > wpaul 2001/08/10 16:15:13 PDT > > Modified files: > sys/kern link_elf.c > Log: > Fix some of the GDB linkage setup. The l_name member of the gdb linkage > structure is always free()ed yet only sometimes malloc()ed. In particular, > it was simply set to point to l_filename from the a linker_file_t in > link_elf_link_preload_finish(). The l_filename had been malloc()ed inside > the kern_linker.c module and was being free()ed twice: once by > link_elf_unload_file() and again by linker_file_unload(), leading to > a panic. > > How to duplicate the problem: > > - Pre-load a kernel module from the loader, i.e. if_sis.ko > - Boot system > - Attempt to unload module with kldunload if_sis > - Bewm > > The problem here is that the case where the module was loaded with kldload > after system boot would work correctly, so this bug went unnoticed until > I stubbed my toe on it just now. (Also, you can only trip this bug if > you compile a kernel with options DDB, but that's the default now.) > > Fix: remember to malloc() a separate copy of the module name for the > l_name member of the gdb linkage structure in three places where the > linkage structure can be initialized. I must be misremembering that at one point you couldn't unload a preloaded module... -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message