From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#11398: 24.0.95; Segfault in unexec on Linux 3.3* with grsecurity/PaX Date: Wed, 28 Aug 2019 15:52:27 +0200 Message-ID: References: <20386.19424.760931.54187@a1i15.kph.uni-mainz.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="67840"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Jan =?UTF-8?Q?Dj=C3=A4rv?= , 11398@debbugs.gnu.org To: Ulrich Mueller Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 28 15:53:33 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i2yOD-000HS1-17 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Aug 2019 15:53:33 +0200 Original-Received: from localhost ([::1]:36692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2yOB-0008Uy-LT for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Aug 2019 09:53:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45362) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2yNj-0008TI-I0 for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 09:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2yNi-0006iw-4B for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 09:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2yNi-0006in-1F for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 09:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i2yNh-0003Ku-Tn for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2019 09:53:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <20386.19424.760931.54187@a1i15.kph.uni-mainz.de> Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Aug 2019 13:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11398 X-GNU-PR-Package: emacs Original-Received: via spool by 11398-submit@debbugs.gnu.org id=B11398.156700036712802 (code B ref 11398); Wed, 28 Aug 2019 13:53:01 +0000 Original-Received: (at 11398) by debbugs.gnu.org; 28 Aug 2019 13:52:47 +0000 Original-Received: from localhost ([127.0.0.1]:49970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2yNS-0003KP-Mj for submit@debbugs.gnu.org; Wed, 28 Aug 2019 09:52:46 -0400 Original-Received: from mail-pl1-f180.google.com ([209.85.214.180]:42856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2yNR-0003KB-DM for 11398@debbugs.gnu.org; Wed, 28 Aug 2019 09:52:45 -0400 Original-Received: by mail-pl1-f180.google.com with SMTP id y1so13792plp.9 for <11398@debbugs.gnu.org>; Wed, 28 Aug 2019 06:52:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=2EoCfM5hiZkjEWtESXceAtMRpdSwDGkTV/FuntdA/04=; b=CceT8k5nAG2yGJ04LhlY2nu9F/j8ZiLaNmewVgYnXLNdc+OOrw1/ZsTPBfpDbrDS1p Lxr+3FcV7s6Y3yLNdv0RotJd1uST8kBLQGKwIkn6K/UgEy0a+E8TVS87imM7VCRaJmLl nXLFzWtJnb8As+yiX4fbd0HBqaJ06TecpspY1s5VyVcC8BnC95Mw3f0yDAcfnDOutgBE 5mqHbzgguhB2Betskun1KjeK78+Ia3tZHkZmqp/8D65EkPA34FzYjN0mz8gcw+0sFAxA Rr43vYDSjrYn9I+CTYBLGOEr5Jj/n2GzvJlx+0AArbzirfTp7ayeJ8hccLD3z/OIfu+P WqUw== X-Gm-Message-State: APjAAAVIra7gRF1qSiiysx1VWv4rVYKfjfVUW+pdJgtNNEzHTeeeyLuI 2VRrtg5S1qamUuthUzirUU2WVlGyKlsK1KpGosg= X-Google-Smtp-Source: APXvYqzSh886bcF8ndufjP53U6lAi/Q7Rrb3qRMzJuhSHmy1uO6YgSuRRAfuT+ZPlbj76raC9Phl6NTSjM6l6A6kr18= X-Received: by 2002:a17:902:465:: with SMTP id 92mr4586027ple.128.1567000359526; Wed, 28 Aug 2019 06:52:39 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:166003 Archived-At: Ulrich Mueller writes: > Forwarding downstream bug . > > Emacs 23.4 and 24.0.95 both fail to build on a Gentoo system with a > sys-kernel/hardened-sources-3.3* kernel, i.e. Linux 3.3* with the > grsecurity/PaX patches from > (e.g., grsecurity-2.9-3.3.4-201204272006.patch). > > Dumping under the name emacs > ************************************************** > Warning: Your system has a gap between BSS and the > heap (15045480 bytes). This usually means that exec-shield > or something similar is in effect. The dump may > fail because of this. See the section about > exec-shield in etc/PROBLEMS for more information. > ************************************************** > make[1]: *** [bootstrap-emacs] Segmentation fault > make[1]: Leaving directory `/var/tmp/portage/app-editors/emacs-23.4-r1/work/emacs-23.4/src' > make: *** [src] Error 2 > > Since it still could be successfully built with hardened-sources-3.2*, > we had first reported this problem to grsecurity/PaX upstream. > However, they claim that it is due to a bug in Emacs' unexec code. > > Quoting from and > following comments: > > | i've debugged the problem and it's a bug in emacs. it wants to create > | a memory dump of its address space without actually looking at what > | memory ranges are available with what access rights. due to recentish > | changes in PaX the gap between the end of the main executable's data > | section and the start of the brk heap is mapped with PROT_NONE rights, > | so no access is allowed and this is where emacs fails. > > | ADDR_NO_RANDOMIZE was added as a workaround to fix userland bugs > | like what emacs has (the first bug is about assuming a particular > | address space layout that no standard has ever guaranteed, the > | second bug is that emacs doesn't use the kernel provided interface > | to discover its own address space layout). > > | [...] fundamentally a bug in emacs's memory dumper code, the proper > | fix should be in there. > > Could GNU Emacs upstream comment on this, please? > > Ulrich Is this still an issue with Emacs 27.0.50 (current master branch)? etc/NEWS says: ** Emacs now uses a "portable dumper" instead of unexec. This improves compatibility with memory allocation on modern systems, and in particular better supports the Address Space Layout Randomization (ASLR) feature, a security technique used by most modern operating systems. Thanks, Stefan Kangas