From owner-freebsd-current@FreeBSD.ORG Mon Aug 1 14:22:45 2011 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57861106564A; Mon, 1 Aug 2011 14:22:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 711E68FC0A; Mon, 1 Aug 2011 14:22:44 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA27915; Mon, 01 Aug 2011 17:22:42 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4E36B6B1.60804@FreeBSD.org> Date: Mon, 01 Aug 2011 17:22:41 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110705 Thunderbird/5.0 MIME-Version: 1.0 To: John Baldwin References: <201108010852.37607.jhb@freebsd.org> In-Reply-To: <201108010852.37607.jhb@freebsd.org> X-Enigmail-Version: 1.2pre Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current@FreeBSD.org, Andrew Thompson Subject: Re: variable init 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: Mon, 01 Aug 2011 14:22:46 -0000 on 01/08/2011 15:52 John Baldwin said the following: > On Monday, August 01, 2011 3:09:27 am Andrew Thompson wrote: >> Hi, >> >> Looking at, >> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=159345 >> >> The lock is a global variable, declared as >> >> static struct mtx lagg_list_mtx; >> >> I would expect this to be zeroed memory, is this guaranteed? > > Yes, but when if_lagg.ko is loaded, the runtime linker resolves references to > 'lagg_list_mtx' to point to the lock that is in the kernel's .bss from the > compiled-in lagg, not the one in the .ko file. However, both initializer > functions run (the one from the kernel and the one from the .ko) which causes > the panic. Tangentially related: kib has/had a patch for proper hiding of static symbols from kernel runtime linker symbol resolution. It would be nice to get that into the tree some day. -- Andriy Gapon