From owner-freebsd-current@FreeBSD.ORG Sat May 27 15:12:11 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3977916BC0A for ; Sat, 27 May 2006 15:12:11 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from ems01.seccuris.com (ems01.seccuris.com [204.112.0.35]) by mx1.FreeBSD.org (Postfix) with SMTP id 797D343D7D for ; Sat, 27 May 2006 15:12:10 +0000 (GMT) (envelope-from csjp@FreeBSD.org) Received: (qmail 13778 invoked by uid 86); 27 May 2006 15:35:05 -0000 Received: from unknown (HELO ?127.0.0.1?) (204.112.0.37) by ems01.seccuris.com with SMTP; 27 May 2006 15:35:05 -0000 Message-ID: <44786C48.7030109@FreeBSD.org> Date: Sat, 27 May 2006 10:12:08 -0500 From: "Christian S.J. Peron" User-Agent: Thunderbird 1.5.0.2 (Macintosh/20060308) MIME-Version: 1.0 To: John Baldwin References: <200605241749.02885.jhb@freebsd.org> In-Reply-To: <200605241749.02885.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: current@freebsd.org Subject: Re: [PATCH] Fixup locking for kernel-linker, needs ndis testing(!) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 May 2006 15:12:23 -0000 Currently, we are using Giant to serialize access into the sysctl tree. This means that if the kernel linker is not picking up Giant, there could be a race between when the kernel modules load/unload sysctls, and somebody reading the sysctl tree. I am not sure what the best thing to do here is yet. I've looked at the locking for sysctl tree, and locking these entry points can be sticky due to the recursive nature of the code. John Baldwin wrote: > I've reworked the locking for the kernel linker to convert the existing > kld_mtx to an sx lock and extend it's scope to cover all of the various > linker-related data structures. I also changed the kernel linker API a bit > to make it more amenable to locking in that I added a 'linker_file_foreach' > that iterates over the list of linker files calling a supplied predicate > function and made the functions to lookup a linker file by name or index > private. This meant that the ndis and hwpmc code had to stop fondling the > kernel linker internals. I also made the VFS Giant locking in ndis and the > kernel linker conditional such that it only locks Giant for non-MPSAFE > filesystems. > > I have runtested this patch a while back, but the ndis and hwpmc parts have > only been compile tested. Please test. > > http://www.FreeBSD.org/~jhb/patches/kld.patch > > -- Christian S.J. Peron csjp@FreeBSD.ORG FreeBSD Committer FreeBSD Security Team