From owner-freebsd-arch@FreeBSD.ORG Tue Sep 18 15:53:18 2012 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F12FB106566C; Tue, 18 Sep 2012 15:53:17 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id A918A8FC12; Tue, 18 Sep 2012 15:53:17 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id E29653B755; Tue, 18 Sep 2012 15:53:09 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q8IFr9ei022287; Tue, 18 Sep 2012 15:53:09 GMT (envelope-from phk@phk.freebsd.dk) To: attilio@FreeBSD.org From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 18 Sep 2012 16:44:08 +0100." Content-Type: text/plain; charset=ISO-8859-1 Date: Tue, 18 Sep 2012 15:53:09 +0000 Message-ID: <22286.1347983589@critter.freebsd.dk> Cc: arch@FreeBSD.org Subject: Re: Aliasing issue with TAILQ on ppc64 ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 15:53:18 -0000 In message , Attilio Rao writes: >The only way I can see this >code is safe is, infact, to lock it with proper locks around the >operations. This is not about locking: at the time where this croaks there is only one thread. The problem is that: // Empty, freshly initialized ban_head b = valid_ban_object(); TAILQ_INSERT_HEAD(&ban_head, b, list); be = TAILQ_LAST(&ban_head, banhead_s); Causes a sig#11 in TAILQ_LAST(). I belive it is a NULL dereference, and I belive it happens because the compiler overoptimizes TAILQ_{LAST|PREV}() -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.