From owner-freebsd-current@FreeBSD.ORG Fri Nov 30 16:24:10 2007 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 BF34E16A468 for ; Fri, 30 Nov 2007 16:24:10 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id A5BC013C4F4 for ; Fri, 30 Nov 2007 16:24:10 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id C8D3D5B59; Fri, 30 Nov 2007 08:24:09 -0800 (PST) To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-reply-to: Your message of "Fri, 30 Nov 2007 12:07:43 +0100." <86abowhtz4.fsf@ds4.des.no> Date: Fri, 30 Nov 2007 08:24:09 -0800 From: Bakul Shah Message-Id: <20071130162409.C8D3D5B59@mail.bitblocks.com> Cc: Carl Shapiro , freebsd-current@freebsd.org 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: Fri, 30 Nov 2007 16:24:10 -0000 > > 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.