From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.bugs Subject: bug#11398: 24.0.95; Segfault in unexec on Linux 3.3* with grsecurity/PaX Date: Sun, 27 May 2012 14:18:30 +0200 Message-ID: <20418.7062.79013.715572@a1i15.kph.uni-mainz.de> References: <20386.19424.760931.54187@a1i15.kph.uni-mainz.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1338121201 3730 80.91.229.3 (27 May 2012 12:20:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 May 2012 12:20:01 +0000 (UTC) To: 11398@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 27 14:20:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SYcRx-0006Dc-7I for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2012 14:19:57 +0200 Original-Received: from localhost ([::1]:33391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYcRw-0004I3-Qw for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2012 08:19:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYcRt-0004Hx-Ap for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 08:19:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYcRr-0003ri-C3 for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 08:19:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYcRr-0003re-8I for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 08:19:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SYcT0-0003PO-8T for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 08:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ulrich Mueller Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 May 2012 12:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11398 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11398-submit@debbugs.gnu.org id=B11398.133812121513042 (code B ref 11398); Sun, 27 May 2012 12:21:02 +0000 Original-Received: (at 11398) by debbugs.gnu.org; 27 May 2012 12:20:15 +0000 Original-Received: from localhost ([127.0.0.1]:45318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYcSE-0003OI-PX for submit@debbugs.gnu.org; Sun, 27 May 2012 08:20:15 -0400 Original-Received: from a1iwww1.kph.uni-mainz.de ([134.93.134.1]:33499) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYcRt-0003NP-Jw for 11398@debbugs.gnu.org; Sun, 27 May 2012 08:20:13 -0400 Original-Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1iwww1.kph.uni-mainz.de (8.14.4/8.13.4) with ESMTP id q4RCIZ4q013402 for <11398@debbugs.gnu.org>; Sun, 27 May 2012 14:18:35 +0200 Original-Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.5/8.14.2) with ESMTP id q4RCIZ55005189; Sun, 27 May 2012 14:18:35 +0200 Original-Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.5/8.14.5/Submit) id q4RCIZpO005187; Sun, 27 May 2012 14:18:35 +0200 In-Reply-To: X-Mailer: VM 8.2.0b under 23.4.2 (x86_64-pc-linux-gnu) X-MIME-Autoconverted: from 8bit to quoted-printable by a1iwww1.kph.uni-mainz.de id q4RCIZ4q013402 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60393 Archived-At: The patch included below (against trunk of today) fixes the problem for me. I've not added a configure option to control usage of paxctl, because: - Generally, the paxctl utility should be available on PaX enabled Linux systems. - On non-PaX systems (but where paxctl exists for some reason) it is harmless if the PaX flags of temacs are modified. In any case, the flags of the final emacs binary will be restored to their default. --- emacs-orig/ChangeLog +++ emacs/ChangeLog @@ -1,3 +1,7 @@ +2012-05-27 Ulrich M=FCller + + * configure.in (PAXCTL): Check for paxctl. (Bug#11398) + 2012-05-27 Paul Eggert =20 Assume gnulib does largefile. --- emacs-orig/configure.in +++ emacs/configure.in @@ -713,6 +713,8 @@ AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin) dnl Don't use GZIP, which is used by gzip for additional parameters. AC_PATH_PROG(GZIP_PROG, gzip) +AC_PATH_PROG(PAXCTL, paxctl,, + [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin]) =20 =20 ## Need makeinfo >=3D 4.7 (?) to build the manuals. --- emacs-orig/src/ChangeLog +++ emacs/src/ChangeLog @@ -1,3 +1,11 @@ +2012-05-27 Ulrich M=FCller + + * Makefile.in (PAXCTL): Define. + (temacs$(EXEEXT)): Disable memory randomization for the temacs + binary via PaX flags if the paxctl utility is available. + (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)): Restore PaX flags to + their default. (Bug#11398) + 2012-05-27 Paul Eggert =20 * lisp.h [REL_ALLOC]: Omit duplicate prototypes. --- emacs-orig/src/Makefile.in +++ emacs/src/Makefile.in @@ -113,6 +113,12 @@ ## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason). TEMACS_LDFLAGS2 =3D @TEMACS_LDFLAGS2@ =20 +## If available, the full path to the paxctl program. +## On grsecurity/PaX systems, unexec will fail due to a gap between +## the bss section and the heap. This can be prevented by disabling +## memory randomization in temacs with "paxctl -r". See bug#11398. +PAXCTL =3D @PAXCTL@ + ## Some systems define this to request special libraries. LIBS_SYSTEM=3D@LIBS_SYSTEM@ =20 @@ -403,6 +409,7 @@ -f list-load-path-shadows || true; \ else \ LC_ALL=3DC $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ + test "X$(PAXCTL)" =3D X || $(PAXCTL) -zex emacs$(EXEEXT); \ ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ ./emacs -batch -f list-load-path-shadows || true; \ fi @@ -450,6 +457,8 @@ temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)= /libgnu.a $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2= ) \ -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES) + test "$(CANNOT_DUMP)" =3D "yes" || \ + test "X$(PAXCTL)" =3D X || $(PAXCTL) -r temacs$(EXEEXT) =20 ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them @@ -597,6 +606,7 @@ ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ else \ $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ + test "X$(PAXCTL)" =3D X || $(PAXCTL) -zex emacs$(EXEEXT); \ mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ fi @: Compile some files earlier to speed up further compilation.