Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2007 13:28:24 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Carl Shapiro <carl.shapiro@gmail.com>
Cc:        freebsd-current@freebsd.org, davidxu@freebsd.org
Subject:   Re: Serious compatibility breakage in -current.
Message-ID:  <20071129112824.GD83121@deviant.kiev.zoral.com.ua>
In-Reply-To: <4dcb5abd0711290226u69105089ya10526519e5cc12d@mail.gmail.com>
References:  <4dcb5abd0711290226u69105089ya10526519e5cc12d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--hxkXGo8AKqTJ+9QI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 29, 2007 at 02:26:11AM -0800, Carl Shapiro wrote:
> Developers,
>=20
> 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.
>=20
> 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.
>=20
> 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.
>=20
> 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.
>=20
> Thanks,
>=20
> 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)
=20
 			if (i =3D=3D SIGSEGV)
 				ucode =3D SEGV_MAPERR;
-			else {
-				i =3D SIGSEGV; /* XXX hack */
-				ucode =3D SEGV_ACCERR;
-			}
+			else
+				ucode =3D BUS_ADRERR;
 			break;
=20
 		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)
=20
 			if (i =3D=3D SIGSEGV)
 				ucode =3D SEGV_MAPERR;
-			else {
-				i =3D SIGSEGV; /* XXX hack */
-				ucode =3D SEGV_ACCERR;
-			}
+			else=20
+				ucode =3D BUS_ADRERR;
 			addr =3D eva;
 			break;
=20

--hxkXGo8AKqTJ+9QI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHTqJXC3+MBN1Mb4gRAiJRAJ9D3FAHt/97MdF3QJVEJeWC8Dz9KQCgyva6
kK6XqNk9aBhyvtVTk2oIDek=
=qlYG
-----END PGP SIGNATURE-----

--hxkXGo8AKqTJ+9QI--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071129112824.GD83121>