From owner-freebsd-bugs@FreeBSD.ORG Wed Nov 28 09:00:03 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9FC016A475 for ; Wed, 28 Nov 2007 09:00:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A80E013C4D5 for ; Wed, 28 Nov 2007 09:00:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lAS903TV070583 for ; Wed, 28 Nov 2007 09:00:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lAS903q0070579; Wed, 28 Nov 2007 09:00:03 GMT (envelope-from gnats) Resent-Date: Wed, 28 Nov 2007 09:00:03 GMT Resent-Message-Id: <200711280900.lAS903q0070579@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, carl shapiro Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC06D16A41B for ; Wed, 28 Nov 2007 08:56:10 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id AB0B613C468 for ; Wed, 28 Nov 2007 08:56:10 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lAS8u21W048066 for ; Wed, 28 Nov 2007 08:56:02 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id lAS8u2hO048064; Wed, 28 Nov 2007 08:56:02 GMT (envelope-from nobody) Message-Id: <200711280856.lAS8u2hO048064@www.freebsd.org> Date: Wed, 28 Nov 2007 08:56:02 GMT From: carl shapiro To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/118304: freebsd 7 delivers unanticipated signal for page faults to freebsd <= 6 binaries X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 09:00:04 -0000 >Number: 118304 >Category: misc >Synopsis: freebsd 7 delivers unanticipated signal for page faults to freebsd <= 6 binaries >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 28 09:00:03 UTC 2007 >Closed-Date: >Last-Modified: >Originator: carl shapiro >Release: 7.0-BETA3 >Organization: self >Environment: FreeBSD freebsd7 7.0-BETA3 FreeBSD 7.0-BETA3 #0: Fri Nov 16 22:20:33 UTC 2007 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Prior to FreeBSD 7 a SIGBUS is delivered if a page's protection is violated. FreeBSD 7 changed this to SIGSEGV. Older executables which expect SIGBUS when a page's protection is violated now unexpectedly receive a SIGSEGV. This breaks applications which attempt to handle page protection binaries. Garbage collectors that implement write barriers through page protection (boehm gc, cmucl, etc.) are one such application. >How-To-Repeat: Start on a FreeBSD 6 system. freebsd6 $ cc -o mmap6 mmap.c freebsd6 $ ./mmap6 __FreeBSD_version=601000 signum=10,info->si_code=12,context=0xbfbfe880 Transfer the mmap6 binary to a FreeBSD 7 system to resume the test case. freebsd7 $ ./mmap6 __FreeBSD_version=601000 signum=11,info->si_code=2,context=0xbfbfe9d0 freebsd7 $ cc -o mmap7 mmap.c freebsd7 $ ./mmap7 __FreeBSD_version=700055 signum=11,info->si_code=2,context=0xbfbfe9e0 Note the different signal and different subcode. Here is the test program. /* mmap.c */ #include #include #include #include #include void handler(int signum, siginfo_t *info, void *context) { fprintf(stderr, "__FreeBSD_version=%d\n", __FreeBSD_version); fprintf(stderr, "signum=%d,info->si_code=%d,context=%p\n", signum, info->si_code, context); exit(1); } int main(int argc, char *argv[]) { struct sigaction sa; size_t len = 0x1000; char *p = mmap(0, len, PROT_NONE, MAP_ANON, -1, 0); if (p == MAP_FAILED) { perror("mmap"); exit(1); } sa.sa_sigaction = handler; sa.sa_flags = SA_SIGINFO; sigaction(SIGBUS, &sa, NULL); sigaction(SIGSEGV, &sa, NULL); *p = 0xff; if (munmap(p, len) == -1) { perror("munmap"); exit(1); } return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: