From owner-cvs-all Fri Aug 10 16:15:24 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 81F6337B409; Fri, 10 Aug 2001 16:15:13 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Received: (from wpaul@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f7ANFD257971; Fri, 10 Aug 2001 16:15:13 -0700 (PDT) (envelope-from wpaul) Message-Id: <200108102315.f7ANFD257971@freefall.freebsd.org> From: Bill Paul Date: Fri, 10 Aug 2001 16:15:13 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern link_elf.c X-FreeBSD-CVS-Branch: HEAD 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 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. Revision Changes Path 1.42 +15 -3 src/sys/kern/link_elf.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message