GNU bug report logs - #29940
guile-2.2.3 does not work pax mprotect

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Thomas Klausner <tk@HIDDEN>; dated Tue, 2 Jan 2018 09:11:02 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 29940 <at> debbugs.gnu.org:


Received: (at 29940) by debbugs.gnu.org; 8 Jan 2018 22:52:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 08 17:52:30 2018
Received: from localhost ([127.0.0.1]:41832 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eYgHO-0001vz-3z
	for submit <at> debbugs.gnu.org; Mon, 08 Jan 2018 17:52:30 -0500
Received: from danbala.ifoer.tuwien.ac.at ([128.130.168.114]:51931)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wiz@HIDDEN>) id 1eYgHM-0001vq-CC
 for 29940 <at> debbugs.gnu.org; Mon, 08 Jan 2018 17:52:28 -0500
Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116)
 id 27B2CA58A; Mon,  8 Jan 2018 23:52:27 +0100 (CET)
Date: Mon, 8 Jan 2018 23:52:27 +0100
From: Thomas Klausner <tk@HIDDEN>
To: 29940 <at> debbugs.gnu.org
Subject: Re: bug#29940: Acknowledgement (guile-2.2.3 does not work pax
 mprotect)
Message-ID: <20180108225227.3rhewyjmictlldnm@danbala>
References: <20180102091028.wbspwmhiepdrxwsr@danbala>
 <sfid-+20180102-101108-+008.55-1@HIDDEN>
 <handler.29940.B.151488425022993.ack <at> debbugs.gnu.org>
 <20180108104222.a5g7fnjbvqspesmm@danbala>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="axuchxmhdxj2z7d6"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20180108104222.a5g7fnjbvqspesmm@danbala>
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 29940
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)


--axuchxmhdxj2z7d6
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Jörg Sonnenberger just committed the attached patch to pkgsrc, which
fixes the problem for me as well, with the commit message:

"Use correct mmap permissions for later PROT_WRITE mprotect."
 Thomas

--axuchxmhdxj2z7d6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch-libguile_loader.c"

$NetBSD: patch-libguile_loader.c,v 1.1 2018/01/08 22:37:08 joerg Exp $

--- libguile/loader.c.orig	2018-01-08 16:21:04.790894906 +0000
+++ libguile/loader.c
@@ -484,7 +484,7 @@ map_file_contents (int fd, size_t len, i
   char *data;
 
 #ifdef HAVE_SYS_MMAN_H
-  data = mmap (NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
+  data = mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
   if (data == MAP_FAILED)
     SCM_SYSERROR;
   *is_read_only = 1;

--axuchxmhdxj2z7d6--




Information forwarded to bug-guile@HIDDEN:
bug#29940; Package guile. Full text available.

Message received at 29940 <at> debbugs.gnu.org:


Received: (at 29940) by debbugs.gnu.org; 8 Jan 2018 10:42:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 08 05:42:26 2018
Received: from localhost ([127.0.0.1]:40233 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eYUss-0000SB-9K
	for submit <at> debbugs.gnu.org; Mon, 08 Jan 2018 05:42:26 -0500
Received: from danbala.ifoer.tuwien.ac.at ([128.130.168.114]:52191)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wiz@HIDDEN>) id 1eYUsq-0000S1-89
 for 29940 <at> debbugs.gnu.org; Mon, 08 Jan 2018 05:42:25 -0500
Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116)
 id 02B5BA5AC; Mon,  8 Jan 2018 11:42:23 +0100 (CET)
Date: Mon, 8 Jan 2018 11:42:22 +0100
From: Thomas Klausner <tk@HIDDEN>
To: 29940 <at> debbugs.gnu.org
Subject: Re: bug#29940: Acknowledgement (guile-2.2.3 does not work pax
 mprotect)
Message-ID: <20180108104222.a5g7fnjbvqspesmm@danbala>
References: <20180102091028.wbspwmhiepdrxwsr@danbala>
 <sfid-+20180102-101108-+008.55-1@HIDDEN>
 <handler.29940.B.151488425022993.ack <at> debbugs.gnu.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="csephjqpp7japrig"
Content-Disposition: inline
In-Reply-To: <handler.29940.B.151488425022993.ack <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 29940
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)


--csephjqpp7japrig
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached patch is a workaround: we can mark the guile binary to
not use the PAX mprotect feature using paxctl +m. On Linux, paxctl has
different flags, so I wrapped it in an "if", and it uses knowledge of
libtool internals, so it is not a good idea to integrate this patch
as-is.

Better would be of course to make guile work with PAX mprotect.
 Thomas

--csephjqpp7japrig
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch-libguile_Makefile.in"

$NetBSD: patch-libguile_Makefile.in,v 1.1 2018/01/08 10:39:45 wiz Exp $

Fix build on NetBSD>=8.

--- libguile/Makefile.in.orig	2017-11-06 09:12:56.000000000 +0000
+++ libguile/Makefile.in
@@ -2444,6 +2444,8 @@ clean-noinstPROGRAMS:
 guile$(EXEEXT): $(guile_OBJECTS) $(guile_DEPENDENCIES) $(EXTRA_guile_DEPENDENCIES) 
 	@rm -f guile$(EXEEXT)
 	$(AM_V_CCLD)$(guile_LINK) $(guile_OBJECTS) $(guile_LDADD) $(LIBS)
+	if [ `uname -s` = "NetBSD" ]; then paxctl +m .libs/guile$(EXEEXT); fi
+
 install-binSCRIPTS: $(bin_SCRIPTS)
 	@$(NORMAL_INSTALL)
 	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \

--csephjqpp7japrig--




Information forwarded to bug-guile@HIDDEN:
bug#29940; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Jan 2018 09:10:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 02 04:10:50 2018
Received: from localhost ([127.0.0.1]:60433 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eWIaw-0005ym-5S
	for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 04:10:50 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37611)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wiz@HIDDEN>) id 1eWIau-0005yU-Av
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 04:10:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <wiz@HIDDEN>) id 1eWIao-0003F1-ED
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 04:10:43 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:39945)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <wiz@HIDDEN>)
 id 1eWIao-0003Ek-A5
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 04:10:42 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56765)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <wiz@HIDDEN>) id 1eWIak-0006KP-07
 for bug-guile@HIDDEN; Tue, 02 Jan 2018 04:10:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <wiz@HIDDEN>) id 1eWIad-00039P-SU
 for bug-guile@HIDDEN; Tue, 02 Jan 2018 04:10:37 -0500
Received: from danbala.ifoer.tuwien.ac.at ([128.130.168.114]:64030)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <wiz@HIDDEN>)
 id 1eWIad-00037W-Le
 for bug-guile@HIDDEN; Tue, 02 Jan 2018 04:10:31 -0500
Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116)
 id 88317A5B0; Tue,  2 Jan 2018 10:10:28 +0100 (CET)
Date: Tue, 2 Jan 2018 10:10:28 +0100
From: Thomas Klausner <tk@HIDDEN>
To: bug-guile@HIDDEN
Subject: guile-2.2.3 does not work pax mprotect
Message-ID: <20180102091028.wbspwmhiepdrxwsr@danbala>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.8 (----)
X-Debbugs-Envelope-To: submit
Cc: Greg Troxel <gdt@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.8 (----)

Hi!

guile-2.2.3 does not compile on NetBSD 8 and NetBSD-current.
During build, it writes stuff like this for basically every file:

gmake[2]: Entering directory '/scratch/lang/guile22/work/guile-2.2.3/bootstrap'
  BOOTSTRAP GUILEC ice-9/eval.go
;;; WARNING: loading compiled file /scratch/lang/guile22/work/guile-2.2.3/prebuilt/64-bit-little-endian/ice-9/eval.go failed:
;;; Throw to key system-error with args ("load-thunk-from-memory" "~A" ("Permission denied") (13))
wrote `ice-9/eval.go'

When I turn off PaX mprotect, the build succeeds.

PaX mprotect is a security feature that forbids memory pages that are
writable and executable, and some memory protection changes that would
allow this. Other programs/libraries (e.g. libffi) needed to be fixed
for this.

Can you please fix this in guile-2.2.x?
(guile-2.0.14 builds fine on such a system.)

Thanks,
 Thomas




Acknowledgement sent to Thomas Klausner <tk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#29940; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.