Serious compatibility breakage in -current.

Kostik Belousov kostikbel at gmail.com
Thu Nov 29 03:28:33 PST 2007


On Thu, Nov 29, 2007 at 02:26:11AM -0800, Carl Shapiro wrote:
> Developers,
> 
> FreeBSD 7 has changed the protection violation signal from SIGBUS to
> SIGSEGV.  Unfortunately, when an old binary is run on a current
> FreeBSD system, protection violations cause a SIGSEGV to be delivered
> to the executable instead of the anticipated SIGBUS.  Binaries
> compiled on older versions of FreeBSD are not prepared to handle
> SIGSEGV in response to page protection violations.
> 
> One consequence of this change is that applications that handle page
> protection violations, such as the CMUCL Lisp compiler have broken.
> CMUCL binaries compiled for FreeBSD 4, FreeBSD 5, and FreeBSD 6 crash
> on -current.  Investments FreeBSD users have in binaries that handle
> page protection violations, such as things that link against boehm-gc,
> are lost forever.  This significantly increases the cost of an upgrade
> to FreeBSD 7.
> 
> The switch from SIGBUS to SIGSEGV is well motivated.  However, it is
> not clear that consideration was given to binaries running under
> compat{4,5,6}x.  One would expect the compat infrastructure to
> translate protection violation signals from SIGSEGV to SIGBUS while
> executing older binaries.  This would ensure that the applications
> that establish SIGBUS handlers to catch protection violations continue
> to work.
> 
> Among the open source operating systems the FreeBSD project has one of
> the best traditions of supporting old binaries.  It would truly be a
> shame for this tradition to abruptly end as of the next major release.
>  As a developer who supports several versions of FreeBSD through
> binary compatibility anything that can help us avoid breakage as of
> the next FreeBSD release would be appreciated.
> 
> Thanks,
> 
> Carl (and the many FreeBSD users of CMUCL)

I can confirm that FreeBSD-6 binary of the CMUCL 19d does not work. It
is interesting that sbcl has no problems on RELENG_7.

The change of the raised signal was introduced in the following commit:
i386/i386/trap.c, revision 1.282
amd64/amd64/trap.c, revision 1.295
date: 2005/10/14 12:43:45;  author: davidxu;  state: Exp;  lines: +41 -12

Please, try the patch below and report whether it is enough to fix cmucl
and any other regressions.

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 62d81f6..ba32fc7 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -311,10 +311,8 @@ trap(struct trapframe *frame)
 
 			if (i == SIGSEGV)
 				ucode = SEGV_MAPERR;
-			else {
-				i = SIGSEGV; /* XXX hack */
-				ucode = SEGV_ACCERR;
-			}
+			else
+				ucode = BUS_ADRERR;
 			break;
 
 		case T_DIVIDE:		/* integer divide fault */
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index e66fa1e..3127488 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -374,10 +374,8 @@ trap(struct trapframe *frame)
 
 			if (i == SIGSEGV)
 				ucode = SEGV_MAPERR;
-			else {
-				i = SIGSEGV; /* XXX hack */
-				ucode = SEGV_ACCERR;
-			}
+			else 
+				ucode = BUS_ADRERR;
 			addr = eva;
 			break;
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20071129/221d0a2f/attachment.pgp


More information about the freebsd-current mailing list