From owner-svn-src-head@freebsd.org Fri Sep 8 17:10:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67712E22FFD; Fri, 8 Sep 2017 17:10:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 431AD34CC; Fri, 8 Sep 2017 17:10:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (unknown [50.235.236.73]) by mail.baldwin.cx (Postfix) with ESMTPSA id 5D1A010A82E; Fri, 8 Sep 2017 13:10:30 -0400 (EDT) Subject: Re: svn commit: r323254 - head/sys/compat/freebsd32 To: Ian Lepore , Maxim Sobolev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709070429.v874Tvom033960@repo.freebsd.org> <6d00a409-2be8-fc15-b68f-993d97366aab@FreeBSD.org> <1504882598.32063.3.camel@freebsd.org> From: John Baldwin Message-ID: Date: Fri, 8 Sep 2017 13:10:29 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1504882598.32063.3.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 08 Sep 2017 13:10:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 17:10:32 -0000 On 9/8/17 10:56 AM, Ian Lepore wrote: > On Fri, 2017-09-08 at 08:14 -0400, John Baldwin wrote: >> On 9/7/17 12:29 AM, Maxim Sobolev wrote: >>> >>> Author: sobomax >>> Date: Thu Sep  7 04:29:57 2017 >>> New Revision: 323254 >>> URL: https://svnweb.freebsd.org/changeset/base/323254 >>> >>> Log: >>>   In the recvmsg32() system call iterate over returned structure(s) >>>   and convert any messages of types SCM_BINTIME, SCM_TIMESTAMP, >>>   SCM_REALTIME and SCM_MONOTONIC from 64-bit to its 32-bit >>>   representation. Otherwise we either run out of user-supplied >>>   buffer to copy those out resulting in the MSG_CTRUNC or simply >>>   return values that the userland 32-bit code is not going >>>   to parse correctly. This fixes at least two regression tests >>>   failing to function properly in 32-bit compat mode: >>>    >>>       tools/regression/sockets/udp_pingpong >>>       tools/regression/sockets/unix_cmsg >>>    >>>   PR:             kern/222039 >>>   MFC after: 30 days >> Is this correct on !amd64?  Other 32-bit platforms use a 64-bit time_t >> (note the time32_t type defined earlier in freebsd32.h).  struct bintime32 >> should use time32_t for the seconds field, not uint32_t.  I think that >> will be sufficient to make this correct on !amd64 (it also means that >> bintime32 == bintime on !amd64 so you could perhaps use a simpler BT_CP >> for !amd64, but the existing one is probably ok). >> > > The existing one now does *(uint64_t *) on a value that's only aligned > to a 32-bit boundary.  That will work in practice because only i386 has > a 32-bit time_t that will use this code, and it's not a strict- > alignment platform.  It may still cause compiler warnings about > alignment. Mmmm, the code is used on ppc and mips as well (and mips will fault for unaligned access at least). However, once bintime32 is fixed to use time32_t I think the fraction will be 64-bit aligned? I would be fine with BT_CP() being an #ifdef though that just uses "(dst) = (src)" for !amd64. -- John Baldwin