From owner-freebsd-ia64@FreeBSD.ORG Tue Feb 1 10:54:26 2011 Return-Path: Delivered-To: ia64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20A4C1065672; Tue, 1 Feb 2011 10:54:26 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.kpi.ua (comsys.kpi.ua [77.47.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id C3FD48FC13; Tue, 1 Feb 2011 10:54:25 +0000 (UTC) Received: from pm513-1.comsys.kpi.ua ([10.18.52.101] helo=pm513-1.comsys.ntu-kpi.kiev.ua) by comsys.kpi.ua with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PkDSO-0003zI-ES; Tue, 01 Feb 2011 12:27:32 +0200 Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id 1373F1CC44; Tue, 1 Feb 2011 12:28:16 +0200 (EET) Date: Tue, 1 Feb 2011 12:28:15 +0200 From: Andrey Simonenko To: Marcel Moolenaar Message-ID: <20110201102815.GA1953@pm513-1.comsys.ntu-kpi.kiev.ua> References: <201101312256.p0VMuI6F075840@freebsd-current.sentex.ca> <20110131235153.GC1746@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Authenticated-User: simon@comsys.ntu-kpi.kiev.ua X-Authenticator: plain X-Sender-Verify: SUCCEEDED (sender exists & accepts mail) X-Exim-Version: 4.63 (build at 10-Dec-2010 16:36:10) X-Date: 2011-02-01 12:27:32 X-Connected-IP: 10.18.52.101:42324 X-Message-Linecount: 45 X-Body-Linecount: 26 X-Message-Size: 1804 X-Body-Size: 939 Cc: current@freebsd.org, marcel@FreeBSD.org, Pawel Jakub Dawidek , ia64@freebsd.org, FreeBSD Tinderbox Subject: Re: [head tinderbox] failure on ia64/ia64 X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2011 10:54:26 -0000 On Mon, Jan 31, 2011 at 04:56:06PM -0800, Marcel Moolenaar wrote: > > Take the statement at line 116 for example: > *((int *)CMSG_DATA(cmsg)) = fd; > > We're effectively casting from a (char *) to a (int *) and then doing > a 32-bit access (write). The easy fix (casting through (void *) is not > possible, because you cannot guarantee that the address is properly > aligned. cmsg points to memory set aside by the following local > variable: > unsigned char ctrl[CMSG_SPACE(sizeof(fd))]; > > There's no guarantee that the compiler will align the character array > at a 32-bit boundary (though in practice it seems to be). I have seen > this kind of construct fail on ARM and PowerPC for example. > Why not to use such declaration: union { struct cmsghdr cm; char ctrl[CMSG_SPACE(sizeof(fd))]; } control_un; At least this is necessary to satisfy that CMSG_FIRSTHDR() will give address of correctly aligned struct cmsghdr{}.