From owner-freebsd-current@FreeBSD.ORG Mon Dec 3 02:16:00 2007 Return-Path: Delivered-To: freebsd-current@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C1E016A419 for ; Mon, 3 Dec 2007 02:16:00 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2EDC813C4CE; Mon, 3 Dec 2007 02:16:00 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from [127.0.0.1] (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lB32Ftao044219; Mon, 3 Dec 2007 02:15:56 GMT (envelope-from davidxu@freebsd.org) Message-ID: <47536718.1020107@freebsd.org> Date: Mon, 03 Dec 2007 10:16:56 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20070516 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bakul Shah References: <20071130162409.C8D3D5B59@mail.bitblocks.com> In-Reply-To: <20071130162409.C8D3D5B59@mail.bitblocks.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@FreeBSD.org, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , Carl Shapiro Subject: Re: Serious compatibility breakage in -current. 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, 03 Dec 2007 02:16:00 -0000 Bakul Shah wrote: >>>The switch from SIGBUS to SIGSEGV is well motivated. >> >>Is it? I see no mention of it in the commit log for the revision that >>actually implemented the change. David argued on -CURRENT that it is >>more POSIXly correct, provided that he interpreted POSIX correctly; how >>do other operating systems behave in this case? > > > There are two issues: the right thing to do for POSIX and > compatibility with older versions. > > See the memory protection section in > http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_08.html > > Excerpt: > * Write attempts to memory that was mapped without write access, or any > access to memory mapped PROT_NONE, shall result in a SIGSEGV signal. > > * References to unmapped addresses shall result in a SIGSEGV signal. > > * Reference to whole pages within the mapping, but beyond the current > length of the object, shall result in a SIGBUS signal. > > FreeBSD's behavior until 7.0 was opposite of this! It has > followed what has been done at least since 4.3BSD (1986?) > which gave SIGBUS on a protection violation and SIGSEG for > access outside any mapped area. > > Solaris mmap man page is not clear on this -- it says you can > get SIGSEGV or SIGBUS but doesn't indicate which under what > condition. > > The change made for 7.0 doesn't quite do the right thing > either as it doesn't distinguish between unmapped area and > wrong kind of access -- you get SIGSEGV for both. > > So you are breaking compatibility for no good reason. > > Kris Kennaway argus > >>it is far too late in the release cycle to identify and revert the ports >>that already caught up to expecting SIGSEGV, so we'd be breaking a >>different set of applications instead). > > > This is a mess but IMHO the two kinds of breakages are not > equal. For better standards compliance another kernel change > will have to be made in the future in any case. > > FWIW. Er, there was a talk about the the return code from VM API, but I can not find it now, nobody answered my question that the reason why the code is returned from the VM API. I did read POSIX specification carefully before making this change, but I may still missed something. Regards, David Xu