From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 27 06:30:59 2018 Received: (at submit) by debbugs.gnu.org; 27 Oct 2018 10:30:59 +0000 Received: from localhost ([127.0.0.1]:44599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGLrv-0000sU-7Q for submit@debbugs.gnu.org; Sat, 27 Oct 2018 06:30:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGLrs-0000sH-Nx for submit@debbugs.gnu.org; Sat, 27 Oct 2018 06:30:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGLrl-00052n-Fh for submit@debbugs.gnu.org; Sat, 27 Oct 2018 06:30:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51118) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gGLrk-00051g-6h for submit@debbugs.gnu.org; Sat, 27 Oct 2018 06:30:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGLrj-0004ix-Cy for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 06:30:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGLrd-0004vu-Sz for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 06:30:46 -0400 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:36364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGLra-0004Z8-60 for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 06:30:40 -0400 Received: by mail-io1-xd30.google.com with SMTP id o19-v6so2250793iod.3 for ; Sat, 27 Oct 2018 03:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version; bh=UO236Kr6fVaxufKx9GEqLsP8q3oLEEriJlFYjCSzwLs=; b=tdGzdWR5pm3QJongX4pLl2o8cV+GQmw3hUXEpFgpKgeToAfEiQQBznZEVynYqLEd5A ZNRogEMQkAAavBRFZvipQ9CA0pbw+gXB99WDLhgzSJ4ES28xAzIOpfF72agYZFYBbTsd l69aphncKRi8okdMPf3nmsz5oY+0gk9h1y2EwMNyBEXcbjae5uGjH3Ysm+Dv95CB8Dlk JkrN2w4WVfiixO6BmJocpUTr/mbsP3JabEjZkvy6HDoVltC6MryUOdPnmL/bDgVi04XI XeOS0BumqR31AcABHMf3ny7bHP14jIwBvCwDc6U/AVyrbGkA75VqAjbMlRVUB+N6zUuW z8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=UO236Kr6fVaxufKx9GEqLsP8q3oLEEriJlFYjCSzwLs=; b=pqavJzHT3NxKVzz1t0/6Le22Q3iuPnCdmo3we6evH4ZLSc9pVgXfhf+ifpkG8NbNlC 4cva0gm3uvIVkvlU3QrwFWEvrIrcLNV1Z39ve+T362OJ0lz7bIq7GasIa6CGZUst/AZH 0IXJ6eOWWFuJauFU6EJSA/1FteASvQGlNg5Vp1uyXa+4uma2ijY/B5bfScofI9qAYkLg 938rpgfhaxwgBROtEhUr/CKrbyC7LgAXrO74GgoM+DNdeHTPTQqaHiG/3X9IeyjkPiru NbsvAGxRcOXQsTpxGYx6jfQRGHInhI1iDmjFYLq2HlPhYxMHLGnkENZB4Uy9exI6F5mr PlYQ== X-Gm-Message-State: AGRZ1gKU0aC0TDVXnnuR825wh/JLA6SJSTkGvEUUnNKNHxysRsTYmCyq W6RId7yfIPiBp8c0bnVOgbLK9OpGFRILYw== X-Google-Smtp-Source: AJdET5cUJNQlKacx7v7LG+7ZAh/MYFd78tzaxkAYbca6RXKIykrOWzOYmUraDgpOKrb5I4w0xSoy8A== X-Received: by 2002:a6b:b78d:: with SMTP id h135-v6mr3977492iof.274.1540636213059; Sat, 27 Oct 2018 03:30:13 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id l7-v6sm3171310iog.66.2018.10.27.03.30.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 03:30:12 -0700 (PDT) From: Thomas Fitzsimmons To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Dump fails on GNU/Linux ppc64le Date: Sat, 27 Oct 2018 06:35:17 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain 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: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hi Paul, On ppc64le Debian GNU/Linux 9, I'm seeing a bootstrap failure on the master and emacs-26 branches that I didn't see the last time I built Emacs: [...] Dumping under the name emacs ************************************************** Warning: Your system has a gap between BSS and the heap (424960392 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. ************************************************** 22496304 of 33554432 static heap bytes used Makefile:749: recipe for target 'bootstrap-emacs' failed make[1]: *** [bootstrap-emacs] Segmentation fault make[1]: Leaving directory '/home/fitzsim/sources/emacs/src' Makefile:421: recipe for target 'src' failed make: *** [src] Error 2 I bisected the failure to: commit 65889a6d127fcbbbdc1e74d26036e91bd24d1405 Author: Paul Eggert Date: Sun Jul 8 09:04:02 2018 -0700 Fix bootstrap infloop in GNU/Linux alpha * src/emacs.c (main): Do not re-exec if EMACS_HEAP_EXEC is already set (Bug#32083). If I revert that commit's patch, the build succeeds. Thomas From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 27 09:11:19 2018 Received: (at 33174) by debbugs.gnu.org; 27 Oct 2018 13:11:19 +0000 Received: from localhost ([127.0.0.1]:44713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGON4-0004Tc-Vd for submit@debbugs.gnu.org; Sat, 27 Oct 2018 09:11:19 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:37622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGON3-0004TQ-LJ for 33174@debbugs.gnu.org; Sat, 27 Oct 2018 09:11:18 -0400 Received: by mail-it1-f196.google.com with SMTP id e74-v6so4809732ita.2 for <33174@debbugs.gnu.org>; Sat, 27 Oct 2018 06:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Y8FH3wV0VKFJ+HbTmva199fOpRU8qakRaDPz43N/8Bs=; b=JQg4raKPBtJ/WBNclGQBQaJ18aBSdqurouABYBBFHYWs+8YyNBQ+oaNdx8e4sQfYPd YDzchO/IadFFWZvdbhNxAZ6rAjbkZvIJW402+KeMVEt7rQawOhq8Z7fxZ8ll4Kil65Wm 6YPY/yuKbdvRYwAot7AKGE2/OKHTbMQC+7RwNNOb3wiB9i+ck0la40MRv4wW7l5xx3tV MtKOXqhKWMsuVgZ3UgGhZ7t+/Cij+rx6LyMulGDn+Ckbt6cdnDYPNaK7CBMaFtp7yvS9 eSj1dKcOiOlsp2fWPclaoKdZuzxYx+ZgIPJ2VVPSUFcJulPX2y/q6wUIHaQ1u19bLIpg velQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Y8FH3wV0VKFJ+HbTmva199fOpRU8qakRaDPz43N/8Bs=; b=QVrjOH/pVCjwLOyPumEPj+0HAAmpQbD5dOGZ6UkDajJz34KYV4AOoGgMGzjVnk3m0P I9dV6knboOYAPvElgCtzNnJmJzCd3jK7HmFlQNRnwEaKFZrDf1vZnV4n5cFm85BKOZ92 NPppye+8MWgoOxmslZnkXk3eCnI4JF8MzLdEf2c+9IcWvxHfhpoI83RIZrl9dgxgBQCX Kvn5kpeD2UWdMBSxwJkvwkOE9TQ3zptWmezOzwv7eUP5csApGUeuLkK16mjS8o2Rka9z /9SzcO/Sf+usjsQ3FXdJ8Redk4lwtOIa3fjBjsJhYs6SKrhCQ9SjPa9ebJpnhbkxJzcL YTyQ== X-Gm-Message-State: AGRZ1gI5gtMx04d0zN+LEsOlqclAPlXcFZiYdr9B/feBdHkmuckgmt3q MyI/jIxfMIeY4rITkWI4YjAQQKgnRK7ZGw== X-Google-Smtp-Source: AJdET5dFLGQgBjogzTbOcGXZqjWfqcMAp3CtBlzq340yM4JXokY4LF3i1nJP4bDyxuxF48vRr7sWjw== X-Received: by 2002:a24:2b0a:: with SMTP id h10-v6mr5780110ita.73.1540645872143; Sat, 27 Oct 2018 06:11:12 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id r2-v6sm3583131ita.28.2018.10.27.06.11.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Oct 2018 06:11:11 -0700 (PDT) From: Thomas Fitzsimmons To: 33174@debbugs.gnu.org Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: Date: Sat, 27 Oct 2018 09:16:17 -0400 In-Reply-To: (Thomas Fitzsimmons's message of "Sat, 27 Oct 2018 06:35:17 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thomas Fitzsimmons writes: > Hi Paul, > > On ppc64le Debian GNU/Linux 9, I'm seeing a bootstrap failure on the > master and emacs-26 branches that I didn't see the last time I built > Emacs: > > [...] > Dumping under the name emacs > ************************************************** > Warning: Your system has a gap between BSS and the > heap (424960392 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. > ************************************************** > 22496304 of 33554432 static heap bytes used > Makefile:749: recipe for target 'bootstrap-emacs' failed > make[1]: *** [bootstrap-emacs] Segmentation fault > make[1]: Leaving directory '/home/fitzsim/sources/emacs/src' > Makefile:421: recipe for target 'src' failed > make: *** [src] Error 2 > > I bisected the failure to: > > commit 65889a6d127fcbbbdc1e74d26036e91bd24d1405 > Author: Paul Eggert > Date: Sun Jul 8 09:04:02 2018 -0700 > > Fix bootstrap infloop in GNU/Linux alpha > > * src/emacs.c (main): Do not re-exec if EMACS_HEAP_EXEC > is already set (Bug#32083). > > If I revert that commit's patch, the build succeeds. It looks like this segmentation fault is influenced by the setting in /proc/sys/kernel/randomize_va_space. Running by hand in src (with the patch in question applied): ./temacs --batch --load loadup bootstrap - if randomize_va_space contains 2, bootstrap fails: segfaults: Dumping under the name emacs ************************************************** Warning: Your system has a gap between BSS and the heap (752378248 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. ************************************************** 22496304 of 33554432 static heap bytes used Segmentation fault - if randomize_va_space contains 1 or 0, bootstrap succeeds: Loading /home/fitzsim/sources/emacs/lisp/tooltip.el (source)... Finding pointers to doc strings... Finding pointers to doc strings...done Dumping under the name emacs 22496304 of 33554432 static heap bytes used 99079 pure bytes used Thomas From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 27 16:26:19 2018 Received: (at 33174) by debbugs.gnu.org; 27 Oct 2018 20:26:19 +0000 Received: from localhost ([127.0.0.1]:45803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGVA1-0000GK-VO for submit@debbugs.gnu.org; Sat, 27 Oct 2018 16:26:19 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGV9z-0000G5-3N for 33174@debbugs.gnu.org; Sat, 27 Oct 2018 16:26:15 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3241E160065; Sat, 27 Oct 2018 13:26:09 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 9yUAJPbGOVpb; Sat, 27 Oct 2018 13:26:08 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 65D3C160066; Sat, 27 Oct 2018 13:26:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OW4PTD5jybmo; Sat, 27 Oct 2018 13:26:08 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 36093160065; Sat, 27 Oct 2018 13:26:08 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons , 33174@debbugs.gnu.org References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 27 Oct 2018 13:26:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Wonderful. Yet another reason we need to get the pdumper branch working. Anyway: 1. Can you use strace and/or GDB to investigate how ./temacs is disabling address randomization? In the emacs-26 branch, if you run this command in src: strace -f -o /tmp/tr ./temacs --batch --load loadup bootstrap the output file /tmp/tr should contain something like this: 18406 personality(0xffffffff) = 0 (PER_LINUX) 18406 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) 18406 execve("./temacs", ["./temacs", "--batch", "--load", "loadup", "bootstrap"], 0xc521b0 /* 80 vars */) = 0 and later on there should be one more call to 'personality', like this: 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) If it doesn't look like this, please investigate why, by using GDB. 2. What filesystem are you building in, and does it support xattrs? What is the output of the following in your build directory? touch x setfattr -n user.variable -v value x getfattr -n user.variable x 3. What is the output of "getfattr -d src/temacs"? It should be something like this: # file: src/temacs user.pax.flags="er" If not, we need to figure out why not. 4. The output of 'make V=1' should contain something like the following. If not, please investigate why not. setfattr -n user.pax.flags -v er temacs From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 28 04:05:19 2018 Received: (at 33174) by debbugs.gnu.org; 28 Oct 2018 08:05:19 +0000 Received: from localhost ([127.0.0.1]:46586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGg4V-0002sL-59 for submit@debbugs.gnu.org; Sun, 28 Oct 2018 04:05:19 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGg4T-0002s6-4c for 33174@debbugs.gnu.org; Sun, 28 Oct 2018 04:05:17 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2B1A916005A; Sun, 28 Oct 2018 01:05:11 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id M-lxAPYYwVMa; Sun, 28 Oct 2018 01:05:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6842716005E; Sun, 28 Oct 2018 01:05:10 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FrLGSk8XYk2T; Sun, 28 Oct 2018 01:05:10 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4379B16005A; Sun, 28 Oct 2018 01:05:10 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le From: Paul Eggert To: Thomas Fitzsimmons References: Organization: UCLA Computer Science Department Message-ID: Date: Sun, 28 Oct 2018 01:05:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) I built and ran Emacs master on two CentOS 7 ppc64le platforms with no trouble. So the problem is not GNU/Linux ppc64le per se; it's something more specific to your platform. Here are some characteristics of my builds: Emacs master branch commit 3dd16a89bf410d77e9ddc41cbfbbd4b343928d6d ./configure --with-x-toolkit=no --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no Both machines were CentOS 7. On both of them, /proc/sys/kernel/randomize_va_space is 2, just as in your Debian machine. uname -rvmpi reported the following (respectively): 3.10.0-693.11.6.el7.ppc64le #1 SMP Thu Jan 4 18:15:24 GMT 2018 ppc64le ppc64le ppc64le 4.14.0-49.13.1.el7a.ppc64le #1 SMP Wed Sep 26 21:58:41 GMT 2018 ppc64le ppc64le ppc64le gcc --version reported the following (respectively): gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) On the machine running 4.14.0, there was no setfattr or getfattr command; however, ./temacs personality (0xffffffff) returned 0x40000 (i.e., ADDR_NO_RANDOMIZE) and so ./temacs did not reexec itself. I don't know why it returned 0x40000; even little programs that only call personality (0xffffffff) return 0x40000 on this platform. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 28 08:57:09 2018 Received: (at 33174) by debbugs.gnu.org; 28 Oct 2018 12:57:09 +0000 Received: from localhost ([127.0.0.1]:46803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGkcu-0007iV-Q7 for submit@debbugs.gnu.org; Sun, 28 Oct 2018 08:57:08 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:37715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGkcs-0007i4-Uu for 33174@debbugs.gnu.org; Sun, 28 Oct 2018 08:57:07 -0400 Received: by mail-it1-f195.google.com with SMTP id e74-v6so6536960ita.2 for <33174@debbugs.gnu.org>; Sun, 28 Oct 2018 05:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pLSOLdui++phOej1FUirdUiQlHNcIzfjZx8cBTqMdMo=; b=gBRtvU/9IwraXIBl/xriZlDmUcKBEOfGTvfzfBQacqEtD0xFaHTGWxONBQHUZrxPPQ d8G903JoZYjUrBLJydfpftPJXdBZT0na2ESh1oNFXzXGi2226IQUF2Uu0UG95yTk1XNS hOPeC0HH5+bdFzMK4Jo9+PX5CKXaNz5MqVsDqtY9fOL0O0hS1YahMstleU+/RdsT0H3r 2GKdoWBR32ipRTooDJ8IBLNMxsOyEt/heTJhIRuhJjPpP0OXYoLtnnUe0QXf3ODkpIYK ja8SEIhM/ZUc9kEp04wutut3uR43Mv59ELZrKF9Lay/eY966CEN8QuYRZVE5dgJvMsIE xjKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pLSOLdui++phOej1FUirdUiQlHNcIzfjZx8cBTqMdMo=; b=liP8OIq77eKbQpQds3m6KhW+JzGO9tJNyZcJrrErcboMXcfw+sP5UKlRP201Si4ORX 3pdFlsN3nq8b8hPmSDBLtWF8wSwujKxM7ym+eqnRlUhpSF+/69632ebKcg4JRFWlechx lEWE3HrijVGV10aOWwZ+4yTX1YTfG+Shi2hH2RRPVFF4/V9pusIPLMAUoLKJIwkLm2AN z1uwR7a7vw2Vhv0iiH1ldvgdvncnHY/OsqIWRGu4J2gk5MbeK5PPAO8q9HE53rnZZ4IY 1iKdRvgmMcCdg0snrSBX788hXVDqWTQaEkKdJtsHM6ucrXV1yHoCLFrm0I0wf6cmNuIg pT1A== X-Gm-Message-State: AGRZ1gLNxRPzbbfMBfWwhCDInk5qYDgJy5gwS4mlnlrs1673s5dAix9L dn6G7McFx1MZ2AN7zKH8y12y0ag3M/O9g3PGX3O2Ew== X-Google-Smtp-Source: AJdET5etblUT+XkchhT+5xijOZGLGSC+R9p+998GXlsZ1yqPq887Ww4r5Hxrabyp/T2bAeLEiKzu0gQaJM6oQggHrss= X-Received: by 2002:a24:21d5:: with SMTP id e204-v6mr7681823ita.127.1540731421369; Sun, 28 Oct 2018 05:57:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:37d5:0:0:0:0:0 with HTTP; Sun, 28 Oct 2018 05:56:59 -0700 (PDT) Received: by 2002:a6b:37d5:0:0:0:0:0 with HTTP; Sun, 28 Oct 2018 05:56:59 -0700 (PDT) In-Reply-To: References: From: Thomas Fitzsimmons Date: Sun, 28 Oct 2018 08:56:59 -0400 Message-ID: Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Paul Eggert Content-Type: multipart/alternative; boundary="00000000000010c4130579497d2b" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000010c4130579497d2b Content-Type: text/plain; charset="UTF-8" On 2018-10-28 4:05 AM, "Paul Eggert" wrote: > > I built and ran Emacs master on two CentOS 7 ppc64le platforms with no trouble. So the problem is not GNU/Linux ppc64le per se; it's something more specific to your platform. OK, thanks for checking. I'm running the Linux-libre 4.18 kernel built from source with powernv_defconfig -- I should have mentioned that in the initial report, sorry. I'll try the debugging steps you've suggested when I get back to my system, and narrow down what the relevant options are. Everything else on my system is stock Debian stretch packages. Thomas --00000000000010c4130579497d2b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On 2018-10-28 4:05 AM, "Paul Eggert" <eggert@cs.ucla.edu> wrote:
>
> I built and ran Emacs master on two CentOS 7 ppc64le platforms with no= trouble. So the problem is not GNU/Linux ppc64le per se; it's somethin= g more specific to your platform.

OK, thanks for checking. I'm running the Linux-libre 4.1= 8 kernel built from source with powernv_defconfig -- I should have mentione= d that in the initial report, sorry.=C2=A0 I'll try the debugging steps= you've suggested when I get back to my system, and narrow down what th= e relevant options are. Everything else on my system is stock Debian stretc= h packages.

Thomas

--00000000000010c4130579497d2b-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 28 15:23:00 2018 Received: (at 33174) by debbugs.gnu.org; 28 Oct 2018 19:23:00 +0000 Received: from localhost ([127.0.0.1]:49332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqeK-0004dH-9z for submit@debbugs.gnu.org; Sun, 28 Oct 2018 15:23:00 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGqeI-0004d4-Lg for 33174@debbugs.gnu.org; Sun, 28 Oct 2018 15:22:59 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E081C160064; Sun, 28 Oct 2018 12:22:52 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id XpF5WpS_wQu8; Sun, 28 Oct 2018 12:22:52 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 13614160066; Sun, 28 Oct 2018 12:22:52 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YWoZG7CrCKUm; Sun, 28 Oct 2018 12:22:51 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E419B160064; Sun, 28 Oct 2018 12:22:51 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <784dd857-cde9-d13d-0afb-234f5cdafb79@cs.ucla.edu> Date: Sun, 28 Oct 2018 12:22:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thomas Fitzsimmons wrote: > I'm running the Linux-libre 4.18 kernel built from > source with powernv_defconfig In that case, please also verify that your kernel configuration has enabled XATTR_PAX. See, for example, . If you have a superhardened kernel that refuses to disable ASLR under any circumstances, then you'll need to build Emacs with './configure CANNOT_DUMP=yes', something I can't recommend for production until we get the pdumper branch merged in. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 28 21:41:52 2018 Received: (at 33174) by debbugs.gnu.org; 29 Oct 2018 01:41:52 +0000 Received: from localhost ([127.0.0.1]:49521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGwYx-00079h-NO for submit@debbugs.gnu.org; Sun, 28 Oct 2018 21:41:52 -0400 Received: from mail-it1-f178.google.com ([209.85.166.178]:37549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGwYv-00079R-J5 for 33174@debbugs.gnu.org; Sun, 28 Oct 2018 21:41:50 -0400 Received: by mail-it1-f178.google.com with SMTP id e74-v6so7662264ita.2 for <33174@debbugs.gnu.org>; Sun, 28 Oct 2018 18:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=h4u+/G3urEI7mm0fo94KqNlTEz2KvKh5etjZn8+RVxU=; b=qEkzIwQMEPgn2JOA5el6yn2avklDmth5RCHlLXR7YH0WoWi9n/HFRq1FrfJDcktjkF +N7PcWwF9raBczJ/s76QZLJ8h7blpKodynN5ieYZ/H+4F5zfIVQ4DEZnPHLwBWkrugUO CPRXpWjyQ2iETJS2MRTfuUvlhaZzi0fx8vu8I9ccjNzJOFkFAK+jMZwTltlaajWebhGo KTq25AKCK7UhtWbKKfkOnO8N2dBC/DGWjB5Np6BxRnacZzsT+oLT2DE/rDVUBRQsayCO HWVHyiBHp3+ak1QMuiGwmVWG8WPtC6xB85SkxnUCcVizNYWNWUfHcLytAZaSzVE54Vqc EcBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=h4u+/G3urEI7mm0fo94KqNlTEz2KvKh5etjZn8+RVxU=; b=J1vTRc6YtEjzeWRcJL8uHteQ2zn7QEWxt49N8lr51FNlHaoEOotRWdr9R0DIpbIGNb KaZnV0wELnQ9X3zkLL+fOumA78CWezeCFmIv7Bd41sDFDcEtjzLpVD0jXg1cuXsX/jU/ cM6gH2lz8n2WOmomZxA4w84LYqYFq75hAkLWNGKjL956IrKqLvvd6IJQYfhstavj767i OeU8I8KOu2beteKDKMXJ4A4S1cpTJhOUuqStKS8cuOgGBy1x41fDbdIrcqJHhaA5bHdQ vOOmwLOclZejXYoIy8h/OJxk6Os+ZcPqLV1fnjVtjrm2myA52PA4Y5Fqiw5fkQQ1lfrn 4b0g== X-Gm-Message-State: AGRZ1gJkqm0x6vRgr0cUUsrsILTHMNltPTj3EnWQxcUOj7vBrI8WxHVi sHsoXrb/4DisE8iilsVRnciBRoMwFGFZeQ== X-Google-Smtp-Source: AJdET5e5t4LtW+8tEgN/3WkTWqVm67yh4FeL+oOg4kgTzdfOmUiOZTn5SqCgP93Cr2y3xwGOVb06qg== X-Received: by 2002:a02:854e:: with SMTP id g72-v6mr6792653jai.113.1540777303552; Sun, 28 Oct 2018 18:41:43 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id v193-v6sm4617143ita.2.2018.10.28.18.41.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Oct 2018 18:41:42 -0700 (PDT) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: Date: Sun, 28 Oct 2018 21:47:06 -0400 In-Reply-To: (Paul Eggert's message of "Sat, 27 Oct 2018 13:26:07 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: > Wonderful. Yet another reason we need to get the pdumper branch working. Anyway: > > 1. Can you use strace and/or GDB to investigate how ./temacs is > disabling address randomization? In the emacs-26 branch, if you run > this command in src: > > strace -f -o /tmp/tr ./temacs --batch --load loadup bootstrap > > the output file /tmp/tr should contain something like this: > > 18406 personality(0xffffffff) = 0 (PER_LINUX) > 18406 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) > 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) I see the above personality calls exactly as you've shown them. strace never gets to the next execve; the crash happens before the next execve is run, see below. > 18406 execve("./temacs", ["./temacs", "--batch", "--load", "loadup", > "bootstrap"], 0xc521b0 /* 80 vars */) = 0 > > and later on there should be one more call to 'personality', like this: > > 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) > > If it doesn't look like this, please investigate why, by using GDB. When I run the command under gdb, it succeeds, so I had to enable core dumps to get the backtrace: $ gdb ./temacs core GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64le-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./temacs...done. [New LWP 26831] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1". Core was generated by `./temacs --batch --load loadup bootstrap '. Program terminated with signal SIGSEGV, Segmentation fault. #0 __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:111 111 ../sysdeps/powerpc/powerpc64/power7/memcpy.S: No such file or directory. SIGINT is used by the debugger. Are you sure you want to change it? (y or n) [answered Y; input not from terminal] DISPLAY = :0 TERM = dumb Breakpoint 1 at 0x10118108: file emacs.c, line 363. Temporary breakpoint 2 at 0x10137aa8: init_sys_modes. (3 locations) (gdb) thread apply all bt Thread 1 (Thread 0x7fff940a7be0 (LWP 26831)): #0 __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:111 #1 0x00000000101ec188 in memcpy (__len=383855080, __src=0x105cd618, __dest=) at /usr/include/powerpc64le-linux-gnu/bits/string3.h:53 #2 unexec (new_name=0x11b934f8 "/build/emacs/src/emacs", old_name=0x11b93528 "/build/emacs/src/temacs") at unexelf.c:411 #3 0x0000000010110bec in Fdump_emacs (filename=XIL(0x11b945a4), symfile=XIL(0x11b94584)) at emacs.c:2224 #4 0x00000000101a7cb8 in eval_sub (form=...) at eval.c:2244 #5 0x00000000101a8194 in Fprogn (body=XIL(0x107360d3)) at eval.c:459 #6 0x00000000101a7d6c in eval_sub (form=...) at eval.c:2193 #7 0x00000000101ab8bc in Fif (args=...) at eval.c:414 #8 0x00000000101a7d6c in eval_sub (form=...) at eval.c:2193 #9 0x00000000101d8a98 in readevalloop (readcharfun=XIL(0x68d0), infile0=0x7fffc3cef950, sourcename=XIL(0x107216a4), printflag=false, unibyte=..., readfun=XIL(0), start=XIL(0), end=XIL(0)) at lread.c:2048 #10 0x00000000101d90bc in Fload (file=XIL(0x107215a4), noerror=..., nomessage=XIL(0), nosuffix=..., must_suffix=...) at lread.c:1435 #11 0x00000000101a7c34 in eval_sub (form=...) at eval.c:2255 #12 0x00000000101acd18 in Feval (form=XIL(0x10727f03), lexical=...) at eval.c:2061 #13 0x00000000101188f8 in top_level_2 () at keyboard.c:1119 #14 0x00000000101a6410 in internal_condition_case (bfun=0x101188d0 , handlers=..., hfun=0x1011f030 ) at eval.c:1336 #15 0x00000000101188a8 in top_level_1 (ignore=...) at keyboard.c:1127 #16 0x00000000101a6364 in internal_catch (tag=..., func=0x10118800 , arg=XIL(0)) at eval.c:1101 #17 0x000000001011873c in command_loop () at keyboard.c:1088 #18 0x000000001011e89c in recursive_edit_1 () at keyboard.c:695 #19 0x000000001011eeb4 in Frecursive_edit () at keyboard.c:766 #20 0x0000000010017804 in main (argc=, argv=0x7fffc3cf0308) at emacs.c:1717 You can't do that without a process to debug. (gdb) > 2. What filesystem are you building in, ext4 > and does it support xattrs? Yes. > What is the output of the following in your build directory? > > touch x > setfattr -n user.variable -v value x > getfattr -n user.variable x I bootstrapped Debian from a minimal root file system, so I didn't have the attr package installed (i.e., the setfattr and getfattr commands were not found). After I installed it, the output of the above commands is: $ touch x $ setfattr -n user.variable -v value x $ getfattr -n user.variable x # file: x user.variable="value" > 3. What is the output of "getfattr -d src/temacs"? It should be something like this: > > # file: src/temacs > user.pax.flags="er" > > If not, we need to figure out why not. Yes, after I re-ran configure and make after having installed the attr package: $ getfattr -d src/temacs # file: src/temacs user.pax.flags="er" > 4. The output of 'make V=1' should contain something like the > following. If not, please investigate why not. > > setfattr -n user.pax.flags -v er temacs When setfattr is not installed, configure shows: [...] checking for setfattr... no [...] and that command is not run. After I installed the attr package, configure shows: checking for setfattr... yes and the above command shows up in make V=1 output. Thomas From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 03:22:24 2018 Received: (at 33174) by debbugs.gnu.org; 29 Oct 2018 07:22:24 +0000 Received: from localhost ([127.0.0.1]:49882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gH1sW-0000wh-JG for submit@debbugs.gnu.org; Mon, 29 Oct 2018 03:22:24 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gH1sV-0000wU-4N for 33174@debbugs.gnu.org; Mon, 29 Oct 2018 03:22:23 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CD43C16005E; Mon, 29 Oct 2018 00:22:16 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 0f6bZb-9-kef; Mon, 29 Oct 2018 00:22:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 09424160067; Mon, 29 Oct 2018 00:22:16 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xZfcd9tcI7Os; Mon, 29 Oct 2018 00:22:15 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D7C5A16005E; Mon, 29 Oct 2018 00:22:15 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> Date: Mon, 29 Oct 2018 00:22:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thomas Fitzsimmons wrote: > Paul Eggert writes: > >> Wonderful. Yet another reason we need to get the pdumper branch working. Anyway: >> >> 1. Can you use strace and/or GDB to investigate how ./temacs is >> disabling address randomization? In the emacs-26 branch, if you run >> this command in src: >> >> strace -f -o /tmp/tr ./temacs --batch --load loadup bootstrap >> >> the output file /tmp/tr should contain something like this: >> >> 18406 personality(0xffffffff) = 0 (PER_LINUX) >> 18406 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) >> 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) > > I see the above personality calls exactly as you've shown them. > > strace never gets to the next execve; the crash happens before the next > execve is run, see below. > >> 18406 execve("./temacs", ["./temacs", "--batch", "--load", "loadup", >> "bootstrap"], 0xc521b0 /* 80 vars */) = 0 So there are no more system calls after personality(0xffffffff)? That is, the crash happens immediately before any other system calls? What does 'strace' say about the crash? For me, the execve is the first syscall after the 'personality(0xffffffff) = 0x40000'. If you're seeing some other syscall there (or are seeing a crash), please investigate why, presumably with GDB. > When I run the command under gdb, it succeeds, so I had to enable core > dumps to get the backtrace: Core dumps won't help us much I'm afraid. Instead, when debugging ./temacs, please use the GDB command "set disable-randomization off" before issuing the GDB command "run --batch --load loadup bootstrap". From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 21:22:44 2018 Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 01:22:45 +0000 Received: from localhost ([127.0.0.1]:52404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIk0-00027t-OF for submit@debbugs.gnu.org; Mon, 29 Oct 2018 21:22:44 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:32783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIjz-00027f-5M for 33174@debbugs.gnu.org; Mon, 29 Oct 2018 21:22:43 -0400 Received: by mail-it1-f195.google.com with SMTP id p11-v6so1801277itf.0 for <33174@debbugs.gnu.org>; Mon, 29 Oct 2018 18:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cnN+WuU1rXFk7hAQ+XSHkb3OYnzO3m1U6sQ1eeG4HRQ=; b=l8tIgu6jmwjHRDbDe0xx2zO+A+TTK7OKHZcJu74D7wkq6It+G4qKsXgBcZUNDzvoXD bxSrvwxr2HUr4USXZWEYMREm8ZRhbG8olS8czxGWFUO24vtJPo4zst9r/GUCK96FHY2e 3YlHUvk8taHbKCOowMIS07xnfkXeXgpnFegmjAWz12bruiASxpi3eeLPfRZ8L5ZOLgG5 hcokTBpbBDng63Ln388UwiftRMJOn/0KFOdrChEjcVvPCr7RVz6B2W3O9da5r2L89TPN 2/JibPYQvlQF1vQEtTNyALpXXJaRtiHiPAG+UyECULmK2/+oEKdLHHB8CupvdRuVfzgv WbEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=cnN+WuU1rXFk7hAQ+XSHkb3OYnzO3m1U6sQ1eeG4HRQ=; b=lEVznWks4tlKQMv6Cr2MQZxejBpdl9AUVXgTmlpHurRxVFfsYy+GseD7B9KAlRDX8+ phJZzysrZWecHq36ilRAhyQNS+BDD2VH79wNM9c9l88CrsHfqbjsF14LhqfGhJmSyGYV 8C3BbYTu5U/Mqdewjm+bkWFeUynwx3MWg5auX9o8FN1PSEMVkDGkdv/xgbz4/bw/uFL1 Rzx4/b5u82N4HhJtHz2X8llVcW817ihzGbG2djhsVgKOYPCS0MkaLLRDuY8MBUF6MXvk oUVBXE2U1JwsgKl/Amx7j5Bi5l52CN0l5k+lumh1Xob3S7p8idVMRqlRmXIHjzcvsiZ/ U77g== X-Gm-Message-State: AGRZ1gKUOYqJq9gqs8a0HnZvLrvMU1IYKQatRZtYfXGtE62MQc/QATLI HXo83onf8izqz+3p22SGDdvJ7af4tBIGmLrR X-Google-Smtp-Source: AJdET5dN5pAquxkdVb2YBofUDWHb3uEbnc/0eFXc3NJ4fCEiSwD+cazU0Kwy4M1JjFdfA3DwF1mSsA== X-Received: by 2002:a24:ce47:: with SMTP id v68-v6mr79359itg.163.1540862556187; Mon, 29 Oct 2018 18:22:36 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id y103-v6sm9771033ita.24.2018.10.29.18.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 18:22:35 -0700 (PDT) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: <784dd857-cde9-d13d-0afb-234f5cdafb79@cs.ucla.edu> Date: Mon, 29 Oct 2018 21:28:11 -0400 In-Reply-To: <784dd857-cde9-d13d-0afb-234f5cdafb79@cs.ucla.edu> (Paul Eggert's message of "Sun, 28 Oct 2018 12:22:51 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: > Thomas Fitzsimmons wrote: >> I'm running the Linux-libre 4.18 kernel built from >> source with powernv_defconfig > > In that case, please also verify that your kernel configuration has > enabled XATTR_PAX. Hmm, the XATTR_PAX kernel configuration option does not exist in the kernel sources I'm using; I haven't applied any hardening or Grsecurity patches, it's just the upstream Linux-libre 4.18 kernel, built with: make powernv_defconfig make > See, for example, > . If you have a > superhardened kernel that refuses to disable ASLR under any > circumstances, then you'll need to build Emacs with './configure > CANNOT_DUMP=yes', something I can't recommend for production until we > get the pdumper branch merged in. I guess I could experiment with adding the PaX patches to my kernel so that XATTR_PAX would take effect, but I'm surprised Emacs can't complete the bootstrap step when the kernel is in a default configuration. Thomas From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 22:16:51 2018 Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 02:16:51 +0000 Received: from localhost ([127.0.0.1]:52583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJaM-0002mx-NC for submit@debbugs.gnu.org; Mon, 29 Oct 2018 22:16:51 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:52218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJaK-0002he-9q for 33174@debbugs.gnu.org; Mon, 29 Oct 2018 22:16:48 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6A71B160056; Mon, 29 Oct 2018 19:16:42 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id GqmU8u9nZ6pj; Mon, 29 Oct 2018 19:16:41 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9A6AE160060; Mon, 29 Oct 2018 19:16:41 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xVeD4AFjrPjx; Mon, 29 Oct 2018 19:16:41 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 7C9AB160056; Mon, 29 Oct 2018 19:16:41 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: <784dd857-cde9-d13d-0afb-234f5cdafb79@cs.ucla.edu> From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBfgQTAQIAKAUCTIByZAIbAwUJEswDAAYLCQgHAwIG FQgCCQoLBBYCAwECHgECF4AACgkQ7ZfpDmKqfjRRGw/+Ij03dhYfYl/gXVRiuzV1gGrbHk+t nfrI/C7fAeoFzQ5tVgVinShaPkZo0HTPf18x6IDEdAiO8Mqo1yp0CtHmzGMCJ50o4Grgfjlr 6g/+vtEOKbhleszN2XpJvpwM2QgGvn/laTLUu8PH9aRWTs7qJJZKKKAb4sxYc92FehPu6FOD 0dDiyhlDAq4lOV2mdBpzQbiojoZzQLMQwjpgCTK2572eK9EOEQySUThXrSIz6ASenp4NYTFH s9tuJQvXk9gZDdPSl3bp+47dGxlxEWLpBIM7zIONw4ks4azgT8nvDZxA5IZHtvqBlJLBObYY 0Le61Wp0y3TlBDh2qdK8eYL426W4scEMSuig5gb8OAtQiBW6k2sGUxxeiv8ovWu8YAZgKJfu oWI+uRnMEddruY8JsoM54KaKvZikkKs2bg1ndtLVzHpJ6qFZC7QVjeHUh6/BmgvdjWPZYFTt N+KA9CWX3GQKKgN3uu988yznD7LnB98T4EUH1HA/GnfBqMV1gpzTvPc4qVQinCmIkEFp83zl +G5fCjJJ3W7ivzCnYo4KhKLpFUm97okTKR2LW3xZzEW4cLSWO387MTK3CzDOx5qe6s4a91Zu ZM/j/TQdTLDaqNn83kA4Hq48UHXYxcIh+Nd8k/3w6lFuoK0wrOFiywjLx+0ur5jmmbecBGHc 1xdhAFHOwU0ETIByZAEQAKaF678T9wyH4wjTrV1Pz3cDEoSnV/0ZUrOT37p1dcGyj/IXq1x6 70HRVahAmk0sZpYc25PF9D5GPYHFWlNjuPU96rDndXB3hedmBRhLdC4bAXjI4DV+bmdVe+q/ IMnlZRaVlm9EiMCVAR6w13sReu7qXkW9r3RwY2AzXskp/tAe4BRKr1Zmbvi2nbnQ6epEC42r Rbx0B1EhjbIQZ5JHGk24iPT7LdBgnNmos5wYjzwNlkMQD5T0Ydzhk7J+UxwA5m46mOhRDC2r FV/A0gm5TLy8DXjv/Esc4gYnYai6SQqnUEVh5LuV8YCJBnijs+Tiw71x1icmn6xGI45EugJO gec+rLypYgpVp4x0HI5T88qBRYCkxH3Kg8Qo+EWNA9A4LRQ9DX8njona0gf0s03tocK8kBN6 6UoqqPtHBnc4eMgBymCflK12eKfd2YYxnyg9cZazWA5VslvTxpm76hbg5oiAEH/Vg/8MxHyA nPhfrgwyPrmJEcVBafdspJnYQxBYNco2LFPIhlOvWh8r4at+s+M3Lb26oUTczlgdW1Sf3SDA 77BMRnF0FQyE+7AzV79MBN4ykiqaezQxtaF1Fy/tvkhffSo8u+dwG0EgJh+te38gTcISVr0G IPplLz6YhjrbHrPRF1CN5UuL9DBGjxuN35RLNVEfta6RUFlR6NctTjvrABEBAAHCwWUEGAEC AA8FAkyAcmQCGwwFCRLMAwAACgkQ7ZfpDmKqfjSrHA/+KzAKvTxRhA9MWNLxIyJ7S5uJ16gs T3oCjZrBKGEhKMOGX4O0GA6VOEryO7QRCCYah3oxSG38IAnNeiwJXgU9Bzkk85UGbPEd7HGF /VSeHCQwWou6jqUDTSDvn9YhNTdG0KXPM74aC+xr2Zow1O2mhXihgWKD0Dw+0LYPnUOsQ0KO FxHXXYHmRrS1OZPU59BLvc+TRhIhafSHKLwbXK+6ckkxBx6h8z5ccpG0Qs4bFhdFYnFrEieD LoGmnE2YLhdV6swJ9VNCS6pLiEohT3fm7aXm15tZOIyzMZhHRSAPblXxQ0ZSWjq8oRrcYNFx c4W1URpAkBCOYJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: Date: Mon, 29 Oct 2018 19:16:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On 10/29/18 6:28 PM, Thomas Fitzsimmons wrote: > I guess I could experiment with adding the PaX patches to my kernel so > that XATTR_PAX would take effect, but I'm surprised Emacs can't complet= e > the bootstrap step when the kernel is in a default configuration. You're right, the XATTR_PAX stuff is likely a red herring. Emacs should=20 be able to bootstrap without it by using the reexec trick, and=20 bootstrapping does work on Fedora 28 (kernel 4.18.16-200.fc28.x86_64)=20 without XATTR_PAX being used. The main issue now, as I see it, is why Emacs is crashing on re-exec.=20 That is, on my system after I run 'make SETFATTR=3D: bootstrap-emacs' to=20 simulate a system without XATTR_PAX, the command strace -o /tmp/tr ./temacs --batch=C2=A0 --load loadup bootstrap generates the syscalls: ... personality(0xffffffff)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 0 (PER_LINUX) personality(PER_LINUX|ADDR_NO_RANDOMIZE) =3D 0 (PER_LINUX) personality(0xffffffff)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 0x40000=20 (PER_LINUX|ADDR_NO_RANDOMIZE) execve("./temacs", ["./temacs", "--batch", "--load", "loadup",=20 "bootstrap"], 0x852ee10 /* 73 vars */) =3D 0 ... whereas on your system Emacs is crashing instead of issuing the execve.=20 I suspect that something like the following may help you debug: $ cd src $ make clean $ make CFLAGS=3D'-g3 -O0' SETFATTR=3D: temacs $ gdb temacs (gdb) set disable-randomization off (gdb) b personality (gdb) r --batch=C2=A0 --load loadup bootstrap and then poke around to see what 'personality' is returning and whether=20 'disable_address_randomization' succeeds and how 'execve' is being=20 called. I guess on your host, personality (0xffffffff) returns 0, then=20 personality (0x40000) returns 0, then personality (0xffffffff) returns=20 0x40000, then disable_address_randomization () returns true, but it=20 would be helpful to check this. The next thing should be that getenv=20 ("EMACS_HEAP_EXEC") returns NULL; is that what actually happens? And=20 then xputenv ("EMACS_HEAP_EXEC=3Dtrue") should work without crashing; is=20 that right? And is execvp being called and with what arguments? That=20 sort of thing. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 22:38:50 2018 Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 02:38:50 +0000 Received: from localhost ([127.0.0.1]:52675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJvd-0006Dy-T7 for submit@debbugs.gnu.org; Mon, 29 Oct 2018 22:38:50 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:54691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJvb-0006Di-IO for 33174@debbugs.gnu.org; Mon, 29 Oct 2018 22:38:48 -0400 Received: by mail-it1-f195.google.com with SMTP id d6so6490388itl.4 for <33174@debbugs.gnu.org>; Mon, 29 Oct 2018 19:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=6Y5uoDm1CCqEPMgDWptNrRCCBUqn9DlarWpNWNbZ2UA=; b=ZuqKicM/mStF3zvSijO4fsn2T96PcTgwnf/d2PYBjgaGofR6VRu8nlx3apSMvYm14S Kpe0JOxSBjQwYbm90rBokz6IIQ3HWw28iePbHifmW0YSbM8loKWzIMysqtnKyjSQENAM uKZ6eO4V6v/L+WD8mV4kX8GRqs2yKMZa3hzcKTWl9OmebR1JFy267HEu26LuBlaT1r2v gMWC20qSwoqb8QkPgRgJ45EmVvFr4NBQaRSaNiWx2Ivce561iiYc4HfcCkwMeg5003Ur 1SSrtKekl8LYsgw3ERMFbHoackGAtszrEyCagLMIN3KXHu/iYbOqtDF2zAOqVB1Dk8h4 J2Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=6Y5uoDm1CCqEPMgDWptNrRCCBUqn9DlarWpNWNbZ2UA=; b=ijxV1ITiGA9MDoIq2VdQuXBjWvTs1DAA8xQZlE99qlR78wgu6lbSTH+0xARGKznhGY 076958qEUxUou0GnHYhJRv2MhWd6HYCm4pJgwuF/ZAwjAcN7mvJiETDVKA6vyAWhFssg BurtyonLAm462L4EsBn1uagB0qq9sw7TiMLfrg3pMepnKFP1pw3hPmekpNj/Wqq0oqZz Ps5pzzQowyCAoMRKyIbO/JLijm+J1AHzoRtYCR27uEOqlVLX8YyijRT835f+IIQYYGTJ 6473m6jFQuIjccVEzAkN0RS41b4mhP5VJlHMh88jqdSFqwz/V1GNwugLtuStzWxY96Ae z72g== X-Gm-Message-State: AGRZ1gIsz2tp6bKPeNYHgWyg61SGrV2dgdwlXulIe7mhHyIOYPP5+U/c ihqpLtwLp9mofoFxFoNAV4bzq6jPSni/jxag X-Google-Smtp-Source: AJdET5fn+31QdCAxJTA4DLhSFbnT1p9qACOlUYDL+YrypBpvi6SmccZLsi20fYvsrGUjJo+elCoSZw== X-Received: by 2002:a02:3b2c:: with SMTP id c44-v6mr12427960jaa.31.1540867121232; Mon, 29 Oct 2018 19:38:41 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id v15sm5979172itk.12.2018.10.29.19.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 19:38:40 -0700 (PDT) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> Date: Mon, 29 Oct 2018 22:44:16 -0400 In-Reply-To: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> (Paul Eggert's message of "Mon, 29 Oct 2018 00:22:15 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: > Thomas Fitzsimmons wrote: >> Paul Eggert writes: >> >>> Wonderful. Yet another reason we need to get the pdumper branch working. Anyway: >>> >>> 1. Can you use strace and/or GDB to investigate how ./temacs is >>> disabling address randomization? In the emacs-26 branch, if you run >>> this command in src: >>> >>> strace -f -o /tmp/tr ./temacs --batch --load loadup bootstrap >>> >>> the output file /tmp/tr should contain something like this: >>> >>> 18406 personality(0xffffffff) = 0 (PER_LINUX) >>> 18406 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) >>> 18406 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) >> >> I see the above personality calls exactly as you've shown them. >> >> strace never gets to the next execve; the crash happens before the next >> execve is run, see below. >> >>> 18406 execve("./temacs", ["./temacs", "--batch", "--load", "loadup", >>> "bootstrap"], 0xc521b0 /* 80 vars */) = 0 > > So there are no more system calls after personality(0xffffffff)? That > is, the crash happens immediately before any other system calls? There are many more syscalls before the crash. 58215 personality(0xffffffff) = 0 (PER_LINUX) 58215 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) 58215 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) 58215 brk(NULL) = 0x27070000 58215 dup2(0, 0) = 0 58215 dup2(1, 1) = 1 58215 dup2(2, 2) = 2 58215 ugetrlimit(RLIMIT_STACK, {rlim_cur=9792*1024, rlim_max=RLIM64_INFINITY}) = 0 58215 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 58215 fstat(3, {st_mode=S_IFREG|0644, st_size=1679776, ...}) = 0 58215 mmap(NULL, 1679776, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fffb6ed0000 58215 close(3) = 0 58215 open("/usr/lib/powerpc64le-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3 58215 fstat(3, {st_mode=S_IFREG|0644, st_size=26264, ...}) = 0 58215 mmap(NULL, 26264, PROT_READ, MAP_SHARED, 3, 0) = 0x7fffbbd00000 58215 close(3) = 0 58215 futex(0x7fffba001ab8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 58215 timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC|TFD_NONBLOCK) = 3 58215 rt_sigaction(SIGALRM, {sa_handler=0x10209280, sa_mask=[ALRM CHLD PROF WINCH], sa_flags=SA_RESTART}, NULL, 8) = 0 58215 open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 4 58215 read(4, "\315\276O\225", 4) = 4 58215 close(4) = 0 [...] > What does 'strace' say about the crash? [...] 58215 write(2, "Dumping under the name emacs", 28) = 28 58215 write(2, "\n", 1) = 1 58215 stat("/a/b/c/emacs/src/emacs", {st_mode=S_IFREG|0755, st_size=57908416, ...}) = 0 58215 unlink("/a/b/c/emacs/src/emacs") = 0 58215 write(2, "********************************"..., 51) = 51 58215 write(2, "Warning: Your system has a gap b"..., 51) = 51 58215 write(2, "heap (346093672 bytes). This us"..., 61) = 61 58215 write(2, "or something similar is in effec"..., 49) = 49 58215 write(2, "fail because of this. See the s"..., 45) = 45 58215 write(2, "exec-shield in etc/PROBLEMS for "..., 50) = 50 58215 write(2, "********************************"..., 51) = 51 58215 write(2, "22440720 of 33554432 static heap"..., 43) = 43 58215 write(2, "\n", 1) = 1 58215 open("/a/b/c/emacs/src/temacs", O_RDONLY|O_CLOEXEC) = 5 58215 fstat(5, {st_mode=S_IFREG|0755, st_size=23687896, ...}) = 0 58215 mmap(NULL, 23687896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fffb3980000 58215 read(5, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0\25\0\1\0\0\0,\207\1\20\0\0\0\0"..., 23687896) = 23687896 58215 open("/a/b/c/emacs/src/emacs", O_RDWR|O_CREAT|O_CLOEXEC, 0777) = 6 58215 ftruncate(6, 403938496) = 0 58215 mmap(NULL, 403938496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fff9b840000 58215 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x12670000} --- 58215 +++ killed by SIGSEGV +++ I could attach the whole strace output but it's pretty big. > For me, the execve is the first syscall after the > 'personality(0xffffffff) = 0x40000'. If you're seeing some other > syscall there (or are seeing a crash), please investigate why, > presumably with GDB. It seems like it's crashing when trying to memcpy over the BSS area, on this line in unexelf.c (see below): /* Copy over what we have in memory now for the bss area. */ memcpy (new_base + new_data2_offset, (caddr_t) old_bss_addr, bss_size_growth); >> When I run the command under gdb, it succeeds, so I had to enable core >> dumps to get the backtrace: > > Core dumps won't help us much I'm afraid. Instead, when debugging > ./temacs, please use the GDB command "set disable-randomization off" > before issuing the GDB command "run --batch --load loadup bootstrap". (memcpy.S below might not be quite the right version; the Debian libc6-dbg 2.24 package doesn't seem to have that file, so I pointed gdb to a copy within a glibc 2.24 git checkout instead.) [...] Dumping under the name emacs ************************************************** Warning: Your system has a gap between BSS and the heap (652277864 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. ************************************************** 22440720 of 33554432 static heap bytes used Program received signal SIGSEGV, Segmentation fault. __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:111 warning: Source file is more recent than executable. 111 lxvd2x 8,src,7 (gdb) thread apply all bt Thread 1 (Thread 0x7fffb0f47be0 (LWP 23958)): #0 __memcpy_power7 () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:111 #1 0x00000000101ec178 in memcpy (__len=686434792, __src=, __dest=) at /usr/include/powerpc64le-linux-gnu/bits/string3.h:53 #2 unexec (new_name=0x11b934f8 "/a/b/c/emacs/src/emacs", old_name=0x11b93528 "/a/b/c/emacs/src/temacs") at unexelf.c:410 #3 0x0000000010110bec in Fdump_emacs (filename=XIL(0x11b945a4), symfile=XIL(0x11b94584)) at emacs.c:2224 #4 0x00000000101a7cb8 in eval_sub (form=...) at eval.c:2244 #5 0x00000000101a8194 in Fprogn (body=XIL(0x107656d3)) at eval.c:459 #6 0x00000000101a7d6c in eval_sub (form=...) at eval.c:2193 #7 0x00000000101ab8bc in Fif (args=...) at eval.c:414 #8 0x00000000101a7d6c in eval_sub (form=...) at eval.c:2193 #9 0x00000000101d8a98 in readevalloop (readcharfun=XIL(0x68d0), infile0=0x7fffffa503a0, sourcename=XIL(0x10721684), printflag=false, unibyte=..., readfun=XIL(0), start=XIL(0), end=XIL(0)) at lread.c:2048 #10 0x00000000101d90bc in Fload (file=XIL(0x10721584), noerror=..., nomessage=XIL(0), nosuffix=..., must_suffix=...) at lread.c:1435 #11 0x00000000101a7c34 in eval_sub (form=...) at eval.c:2255 #12 0x00000000101acd18 in Feval (form=XIL(0x10727f03), lexical=...) at eval.c:2061 #13 0x00000000101188f8 in top_level_2 () at keyboard.c:1119 #14 0x00000000101a6410 in internal_condition_case (bfun=0x101188d0 , handlers=..., hfun=0x1011f030 ) at eval.c:1336 #15 0x00000000101188a8 in top_level_1 (ignore=...) at keyboard.c:1127 #16 0x00000000101a6364 in internal_catch (tag=..., func=0x10118800 , arg=XIL(0)) at eval.c:1101 #17 0x000000001011873c in command_loop () at keyboard.c:1088 #18 0x000000001011e89c in recursive_edit_1 () at keyboard.c:695 #19 0x000000001011eeb4 in Frecursive_edit () at keyboard.c:766 #20 0x0000000010017804 in main (argc=, argv=0x7fffffa50d58) at emacs.c:1717 Lisp Backtrace: "dump-emacs" (0xffa4fee0) "progn" (0xffa50060) "if" (0xffa501a0) "load" (0xffa505a0) BTW, let me know if you don't think it's useful to debug this further. I'm OK just disabling randomization when I build Emacs for the time being and waiting until the portable dumper work lands, but I'm happy to continue if you think it will lead to a general fix. Thanks, Thomas From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 01:58:29 2018 Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 05:58:29 +0000 Received: from localhost ([127.0.0.1]:53119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHN2r-0000eb-2u for submit@debbugs.gnu.org; Tue, 30 Oct 2018 01:58:29 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHN2o-0000eN-R7 for 33174@debbugs.gnu.org; Tue, 30 Oct 2018 01:58:27 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 464DB16005E; Mon, 29 Oct 2018 22:58:21 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id IENuDmgww_fA; Mon, 29 Oct 2018 22:58:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 75F6D160064; Mon, 29 Oct 2018 22:58:20 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Tb5OkvVKO53h; Mon, 29 Oct 2018 22:58:20 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 5248016005E; Mon, 29 Oct 2018 22:58:20 -0700 (PDT) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> Date: Mon, 29 Oct 2018 22:58:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thomas Fitzsimmons wrote: > BTW, let me know if you don't think it's useful to debug this further. > I'm OK just disabling randomization when I build Emacs for the time > being and waiting until the portable dumper work lands, but I'm happy to > continue if you think it will lead to a general fix. It's not clear when the portable dumper will land; it might not ever land, unfortunately. So I would like to work on bug#33174 a bit longer, if only so that we can put something intelligible into the PROBLEMS file. > It seems like it's crashing when trying to memcpy over the BSS area, on > this line in unexelf.c (see below): By the time the memcpy is run the damage has already been done: the memory layout is messed up and we can't fix that simply by passing different arguments to memcpy. We have to prevent the memory layout from being messed up in the first place by disabling undesirable address space layout randomization and doing this very early in execution. The key question for me is in this set of system calls: > 58215 personality(0xffffffff) = 0 (PER_LINUX) > 58215 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) > 58215 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) > 58215 brk(NULL) = 0x27070000 > 58215 dup2(0, 0) = 0 > 58215 dup2(1, 1) = 1 > 58215 dup2(2, 2) = 2 Surely the call to disable_address_randomization () must have returned true, but can you verify that, either via GDB or (shudder) by inserting print statements? Also, the call from 'main' to getenv ("EMACS_HEAP_EXEC") must have returned NULL. Can you also verify this? And it appears that 'main' must have called xputenv ("EMACS_HEAP_EXEC=true") and execvp (argv[0], argv). But how can this be, since there's no execve syscall? This is the heart of the mystery, and we can find out more about it by using GDB to put breakpoints on 'personality', 'getenv', 'xputenv' and/or 'execvp' and seeing what's going on. Something like this, perhaps: $ gdb temacs (gdb) set disable-randomization off (gdb) b personality (gdb) b getenv (gdb) b xputenv (gdb) b execvp (gdb) r --batch --load loadup bootstrap and seeing which of these functions get executed in what order, and what they return. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 05:25:16 2018 Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 09:25:16 +0000 Received: from localhost ([127.0.0.1]:53361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHQGy-0007ji-6R for submit@debbugs.gnu.org; Tue, 30 Oct 2018 05:25:16 -0400 Received: from mail-it1-f175.google.com ([209.85.166.175]:50207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHQGx-0007jV-03 for 33174@debbugs.gnu.org; Tue, 30 Oct 2018 05:25:15 -0400 Received: by mail-it1-f175.google.com with SMTP id k206-v6so12909385ite.0 for <33174@debbugs.gnu.org>; Tue, 30 Oct 2018 02:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XYs+aaR1f6wMzRW4dr9xnpYpXfH/tLQ9ZQF8EZ5K9fU=; b=Zmy7+1+/3aptWHmrsxevcw/ej09aqVKInpjGzgph0odm9l0PxPTxVu5p5i7lu0Zvdz 8HnZIbYs3+gskojPBxuxzBee2WYnDVgck/GYYuBE47z7YKHd5sg1l4QXpWa45iF1fppj R6nQBMBnXiXQ/ElVqY4S3sCGigHwk6OEWo5/Ml+bGTlTBvRFMfIwhBcNbZ616/WHa8NJ Hxwgj2k/I0LSoMf9tu4wTIZDnwxa8uSAa+NFsXq8mcv0maTyafIVRFKVn1EMkOWAR6NA wk3dWQAcwciwKOyeB5pgw3qi0c7nyvjsMVxgFux80rQVpt0XkKrmRub/uvOxLOz2vzNn aicQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XYs+aaR1f6wMzRW4dr9xnpYpXfH/tLQ9ZQF8EZ5K9fU=; b=G2ThV+9egZwsrITQsbgGZpZmQvUPDh5+fV9+Y9Hzl1Ja06GkOcFYFrocwJPRNlnm5p dmBMFOqB9DjWSJwnnrftmC2gG6Aw0Jo52Z4g1X1EZW2zROoa4YhTFX4X9n2JS3TpDJf1 M4ZE0c1BD3D69Vp4oOwZMqCCHWesdy6HtBJ1n4vQiMNfv+zRuU1+SmkY8Qjqe91eTYIY HFrg2hDodNO71aovzoBID2P8AcE0WvcHOT14yESRp5Y9HyZJW9VQgOr3+rFr/R6I0LfY bRbFy7GkO/dvQryTyKSo9+Esjq8is1nJwNfjH7mFNjT4whlit57CxAcwwh+Q70byfjE3 prCw== X-Gm-Message-State: AGRZ1gJ6vuAiXcELJ8y6d8DbPPCBC9UL56+W/S7GWcRqS4zyCdSyXYmZ nWBRpZZD5D3w7x0ECHBzRAZ0tLD35FLPlh09 X-Google-Smtp-Source: AJdET5clssPNa8hy48q1LTplHG1x+6TrfhQtSqK7iuzyqHlZfJe0Q9uQA3jX8ap6WKvFlD7sZ5lJqA== X-Received: by 2002:a02:3f19:: with SMTP id d25-v6mr337885jaa.101.1540891508969; Tue, 30 Oct 2018 02:25:08 -0700 (PDT) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id z9-v6sm6732511iom.12.2018.10.30.02.25.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 02:25:07 -0700 (PDT) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> Date: Tue, 30 Oct 2018 05:30:47 -0400 In-Reply-To: <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> (Paul Eggert's message of "Mon, 29 Oct 2018 22:58:19 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33174 Cc: 33174@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: > Thomas Fitzsimmons wrote: >> BTW, let me know if you don't think it's useful to debug this further. >> I'm OK just disabling randomization when I build Emacs for the time >> being and waiting until the portable dumper work lands, but I'm happy to >> continue if you think it will lead to a general fix. > > It's not clear when the portable dumper will land; it might not ever > land, unfortunately. So I would like to work on bug#33174 a bit > longer, if only so that we can put something intelligible into the > PROBLEMS file. OK. >> It seems like it's crashing when trying to memcpy over the BSS area, on >> this line in unexelf.c (see below): > > By the time the memcpy is run the damage has already been done: the > memory layout is messed up and we can't fix that simply by passing > different arguments to memcpy. We have to prevent the memory layout > from being messed up in the first place by disabling undesirable > address space layout randomization and doing this very early in > execution. Ah, OK, so the goal is to programmatically do something similar to echo'ing to randomize_va_space, but just for the temacs process. > The key question for me is in this set of system calls: > >> 58215 personality(0xffffffff) = 0 (PER_LINUX) >> 58215 personality(PER_LINUX|ADDR_NO_RANDOMIZE) = 0 (PER_LINUX) >> 58215 personality(0xffffffff) = 0x40000 (PER_LINUX|ADDR_NO_RANDOMIZE) >> 58215 brk(NULL) = 0x27070000 >> 58215 dup2(0, 0) = 0 >> 58215 dup2(1, 1) = 1 >> 58215 dup2(2, 2) = 2 > > Surely the call to disable_address_randomization () must have returned > true, but can you verify that, either via GDB or (shudder) by > inserting print statements? (I sorted out glibc source code and debug symbols so they'll be accurate now). Yes, disable_address_randomization returns true: [...] (gdb) finish Run till exit from #0 0x0000000010136d9c in disable_address_randomization () at sysdep.c:165 0x0000000010016c94 in main (argc=, argv=0x7fffd4430178) at emacs.c:710 710 if (disable_aslr && disable_address_randomization () Value returned is $1 = true [...] > Also, the call from 'main' to getenv ("EMACS_HEAP_EXEC") must have > returned NULL. Can you also verify this? (gdb) c Continuing. Breakpoint 4, 0x00007fff9dc1ef98 in __GI_getenv (name=0x10274ce8 "EMACS_HEAP_EXEC") at getenv.c:34 34 { (gdb) finish Run till exit from #0 0x00007fff9dc1ef98 in __GI_getenv (name=0x10274ce8 "EMACS_HEAP_EXEC") at getenv.c:34 0x0000000010017870 in main (argc=, argv=0x7ffff4883248) at emacs.c:711 711 && !getenv ("EMACS_HEAP_EXEC")) Value returned is $2 = 0x7ffff488fe49 "true" Actually, EMACS_HEAP_EXEC is true! If I unset it, then the bootstrap works with and without "Fix bootstrap infloop in GNU/Linux alpha" applied. I'm building Emacs inside Emacs via M-x shell. "EMACS_HEAP_EXEC=true" is in process-environment. Given that I'm also running EXWM, no matter what build shell I start up, even an xterm, EMACS_HEAP_EXEC is set to "true" in the environment. Ah, by running the "outer" Emacs via a serial console (i.e., not from within Emacs, and starting with EMACS_HEAP_EXEC unset in the environment), I think I see what happened. Because of the ifdef just above the randomization disablement code: # ifdef __PPC64__ bool disable_aslr = true; # else bool disable_aslr = dumping; # endif randomization is unconditionally disabled on PPC64, and so EMACS_HEAP_EXEC is unconditionally set to true in the outer build Emacs's initial-environment. With "Fix bootstrap infloop in GNU/Linux alpha" applied, building Emacs within Emacs on PPC64 will no longer work because the re-exec will be skipped during bootstrap. Maybe can you try building Emacs within Emacs on one of those CentOS machines to confirm? Thanks, Thomas From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 12 01:40:09 2018 Received: (at 33174-done) by debbugs.gnu.org; 12 Nov 2018 06:40:09 +0000 Received: from localhost ([127.0.0.1]:46964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gM5tI-0003vw-0z for submit@debbugs.gnu.org; Mon, 12 Nov 2018 01:40:09 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gM5tE-0003uw-Ol for 33174-done@debbugs.gnu.org; Mon, 12 Nov 2018 01:40:05 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B4B84160098; Sun, 11 Nov 2018 22:39:58 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id SrnO9TMwPjp4; Sun, 11 Nov 2018 22:39:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7342E160079; Sun, 11 Nov 2018 22:39:57 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id r15nyekULMxy; Sun, 11 Nov 2018 22:39:57 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 2F6DC16006C; Sun, 11 Nov 2018 22:39:57 -0800 (PST) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 11 Nov 2018 22:39:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------F7CD2D096B092AF83B9A0320" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174-done Cc: 33174-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------F7CD2D096B092AF83B9A0320 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thomas Fitzsimmons wrote: > Actually, EMACS_HEAP_EXEC is true! OK, thanks, that explains things. I installed the first attached patch to the emacs-26 branch as a quick hack to work around the problem, and the second attached patch to the master branch to come up with a better way to address the underlying issue that doesn't involve fiddling with environment variables. Please let us know if this doesn't work for your platform, as I've tested this only on x86-64. --------------F7CD2D096B092AF83B9A0320 Content-Type: text/x-patch; name="0001-Work-around-dumping-bug-on-GNU-Linux-ppc64le.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Work-around-dumping-bug-on-GNU-Linux-ppc64le.patch" >From 1d79c2ebd9bd9aa36586e57463502373c0296d11 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 11 Nov 2018 22:34:46 -0800 Subject: [PATCH] Work around dumping bug on GNU/Linux ppc64le Problem reported by Thomas Fitzsimmons (Bug#33174). Do not merge to master, as we have a better fix there. * src/Makefile.in (emacs$(EXEEXT)): (bootstrap-emacs$(EXEEXT)): Unset EMACS_HEAP_EXEC before invoking temacs. --- src/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile.in b/src/Makefile.in index 6ed8f3cc91..53c18e7ac0 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -534,6 +534,7 @@ emacs$(EXEEXT): ifeq ($(CANNOT_DUMP),yes) ln -f temacs$(EXEEXT) $@ else + unset EMACS_HEAP_EXEC; \ LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump ifneq ($(PAXCTL_dumped),) $(PAXCTL_dumped) $@ @@ -739,6 +740,7 @@ bootstrap-emacs$(EXEEXT): ifeq ($(CANNOT_DUMP),yes) ln -f temacs$(EXEEXT) $@ else + unset EMACS_HEAP_EXEC; \ $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap ifneq ($(PAXCTL_dumped),) $(PAXCTL_dumped) emacs$(EXEEXT) -- 2.17.1 --------------F7CD2D096B092AF83B9A0320 Content-Type: text/x-patch; name="0001-Fix-dumping-on-GNU-Linux-ppc64le.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-dumping-on-GNU-Linux-ppc64le.patch" >From c14eab222c5208ec0650292c3771a3ee632fdb0d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 11 Nov 2018 22:18:47 -0800 Subject: [PATCH] Fix dumping on GNU/Linux ppc64le Problem reported by Thomas Fitzsimmons (Bug#33174). * src/emacs.c (main): Adjust to sysdep.c changes. * src/sysdep.c (exec_personality): New static var. (disable_address_randomization): Remove, replacing with ... (maybe_disable_address_randomization): ... this new function. Do not set or use an environment variable; use a command-line argument instead, and set the new static var. Migrate the emacs.c personality-change code to here, where it belongs. (emacs_exec_file): Simplify by using new static var. --- src/emacs.c | 23 +---------------- src/lisp.h | 7 +++-- src/sysdep.c | 73 +++++++++++++++++++++++++++++++++------------------- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/emacs.c b/src/emacs.c index 07df191035..512174d562 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -706,28 +706,7 @@ main (int argc, char **argv) dumping = false; #endif - /* True if address randomization interferes with memory allocation. */ -# ifdef __PPC64__ - bool disable_aslr = true; -# else - bool disable_aslr = dumping; -# endif - - if (disable_aslr && disable_address_randomization () - && !getenv ("EMACS_HEAP_EXEC")) - { - /* Set this so the personality will be reverted before execs - after this one, and to work around an re-exec loop on buggy - kernels (Bug#32083). */ - xputenv ("EMACS_HEAP_EXEC=true"); - - /* Address randomization was enabled, but is now disabled. - Re-execute Emacs to get a clean slate. */ - execvp (argv[0], argv); - - /* If the exec fails, warn and then try anyway. */ - perror (argv[0]); - } + argc = maybe_disable_address_randomization (dumping, argc, argv); #ifndef CANNOT_DUMP might_dump = !initialized; diff --git a/src/lisp.h b/src/lisp.h index eb6762678c..383d61274c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4325,9 +4325,12 @@ struct tty_display_info; /* Defined in sysdep.c. */ #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE -extern bool disable_address_randomization (void); +extern int maybe_disable_address_randomization (bool, int, char **); #else -INLINE bool disable_address_randomization (void) { return false; } +INLINE void +maybe_disable_address_randomization (bool dumping, int argc, char **argv) +{ +} #endif extern int emacs_exec_file (char const *, char *const *, char *const *); extern void init_standard_fds (void); diff --git a/src/sysdep.c b/src/sysdep.c index 7a0c8a8ab8..ddcb594f66 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -150,22 +150,52 @@ static const int baud_convert[] = #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE # include -/* Disable address randomization in the current process. Return true - if addresses were randomized but this has been disabled, false - otherwise. */ -bool -disable_address_randomization (void) +/* If not -1, the personality that should be restored before exec. */ +static int exec_personality; + +/* Try to disable randomization if the current process needs it and + does not appear to have it already. */ +int +maybe_disable_address_randomization (bool dumping, int argc, char **argv) { - int pers = personality (0xffffffff); - if (pers < 0) - return false; - int desired_pers = pers | ADDR_NO_RANDOMIZE; + /* Undocumented Emacs option used only by this function. */ + static char const aslr_disabled_option[] = "--__aslr-disabled"; - /* Call 'personality' twice, to detect buggy platforms like WSL - where 'personality' always returns 0. */ - return (pers != desired_pers - && personality (desired_pers) == pers - && personality (0xffffffff) == desired_pers); + if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0) + { + bool disable_aslr = dumping; +# ifdef __PPC64__ + disable_aslr = true; +# endif + exec_personality = disable_aslr ? personality (0xffffffff) : -1; + if (exec_personality & ADDR_NO_RANDOMIZE) + exec_personality = -1; + if (exec_personality != -1 + && personality (exec_personality | ADDR_NO_RANDOMIZE) != -1) + { + char **newargv = malloc ((argc + 2) * sizeof *newargv); + if (newargv) + { + /* Invoke self with undocumented option. */ + newargv[0] = argv[0]; + newargv[1] = (char *) aslr_disabled_option; + memcpy (&newargv[2], &argv[1], argc * sizeof *newargv); + execvp (newargv[0], newargv); + } + + /* If malloc or execvp fails, warn and then try anyway. */ + perror (argv[0]); + free (newargv); + } + } + else + { + /* Our earlier incarnation already disabled ASLR. */ + argc--; + memmove (&argv[1], &argv[2], argc * sizeof *argv); + } + + return argc; } #endif @@ -177,21 +207,12 @@ int emacs_exec_file (char const *file, char *const *argv, char *const *envp) { #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE - int pers = getenv ("EMACS_HEAP_EXEC") ? personality (0xffffffff) : -1; - bool change_personality = 0 <= pers && pers & ADDR_NO_RANDOMIZE; - if (change_personality) - personality (pers & ~ADDR_NO_RANDOMIZE); + if (exec_personality != -1) + personality (exec_personality); #endif execve (file, argv, envp); - int err = errno; - -#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE - if (change_personality) - personality (pers); -#endif - - return err; + return errno; } /* If FD is not already open, arrange for it to be open with FLAGS. */ -- 2.17.1 --------------F7CD2D096B092AF83B9A0320-- From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 12 12:25:02 2018 Received: (at submit) by debbugs.gnu.org; 12 Nov 2018 17:25:02 +0000 Received: from localhost ([127.0.0.1]:48298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMFxO-00032s-5m for submit@debbugs.gnu.org; Mon, 12 Nov 2018 12:25:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMFxM-00032O-I3 for submit@debbugs.gnu.org; Mon, 12 Nov 2018 12:25:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMFxG-0000bH-Kp for submit@debbugs.gnu.org; Mon, 12 Nov 2018 12:24:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54941) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMFxG-0000b9-G0 for submit@debbugs.gnu.org; Mon, 12 Nov 2018 12:24:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMFxF-0000ZS-IF for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2018 12:24:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMFxC-0000Y2-DJ for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2018 12:24:53 -0500 Received: from [195.159.176.226] (port=54146 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMFx8-0000Q7-FN for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2018 12:24:48 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gMFup-0004LV-NJ for bug-gnu-emacs@gnu.org; Mon, 12 Nov 2018 18:22:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Andy Moreton Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le Date: Mon, 12 Nov 2018 17:24:27 +0000 Lines: 69 Message-ID: <8636s68b04.fsf@gmail.com> References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:HyV+mknBpCMHCftXuBD6wB0J90I= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Sun 11 Nov 2018, Paul Eggert wrote: > Thomas Fitzsimmons wrote: >> Actually, EMACS_HEAP_EXEC is true! > > OK, thanks, that explains things. I installed the first attached patch to the > emacs-26 branch as a quick hack to work around the problem, and the second > attached patch to the master branch to come up with a better way to address > the underlying issue that doesn't involve fiddling with environment variables. > Please let us know if this doesn't work for your platform, as I've tested this > only on x86-64. The second patch (applied to master) breaks the build on Windows. > diff --git a/src/lisp.h b/src/lisp.h > index eb6762678c..383d61274c 100644 > --- a/src/lisp.h > +++ b/src/lisp.h > @@ -4325,9 +4325,12 @@ struct tty_display_info; > > /* Defined in sysdep.c. */ > #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE > -extern bool disable_address_randomization (void); > +extern int maybe_disable_address_randomization (bool, int, char **); > #else > -INLINE bool disable_address_randomization (void) { return false; } > +INLINE void > +maybe_disable_address_randomization (bool dumping, int argc, char **argv) > +{ > +} The return type must be consistent as it is used by its caller: C:/emacs/git/emacs/master/src/emacs.c: In function 'main': C:/emacs/git/emacs/master/src/emacs.c:709:8: error: void value not ignored as it ought to be argc = maybe_disable_address_randomization (dumping, argc, argv); ^ The obvious fix seems to work: #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE extern int maybe_disable_address_randomization (bool, int, char **); #else INLINE int maybe_disable_address_randomization (bool dumping, int argc, char **argv) { return argc; } #endif > +int > +maybe_disable_address_randomization (bool dumping, int argc, char **argv) > { [snipped] > + if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0) > + { [snipped] > + } > + else > + { > + /* Our earlier incarnation already disabled ASLR. */ > + argc--; > + memmove (&argv[1], &argv[2], argc * sizeof *argv); > + } This looks wrong: the memmove size is one element too long, and if argc was 2 then there is an out of bounds access. AndyM From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 12 21:27:57 2018 Received: (at 33174-done) by debbugs.gnu.org; 13 Nov 2018 02:27:57 +0000 Received: from localhost ([127.0.0.1]:48483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMOQn-0001MK-9g for submit@debbugs.gnu.org; Mon, 12 Nov 2018 21:27:57 -0500 Received: from mail-io1-f47.google.com ([209.85.166.47]:35786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMOQl-0001M8-3k for 33174-done@debbugs.gnu.org; Mon, 12 Nov 2018 21:27:55 -0500 Received: by mail-io1-f47.google.com with SMTP id u19so3519234ioc.2 for <33174-done@debbugs.gnu.org>; Mon, 12 Nov 2018 18:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=eTS6duZ7HYMOVqsaKeBzBBHUHwiFlkxSpDFXeRbdgN0=; b=CfJ27Ru2SKOCVrL1aSaoD/nTOeAGHCLiBDL8qsvK8zt63YOTSu54wKCmQznW5GEZKs ToF2Ic4W46BO5YdPVg3+Wlv8PN9pvecULKwUGQx7YUJ23AM5Q375kh5XI1Qe6xk77wDP jx7FO9k4J9GQzrgk5J/oYssjut1mNo0jnRVJNqoYXuCubN7wJ3w/MNYxKj0XqsUeiw56 Pu/QtqktTs4bB+Hy640eA1fKWc3U6Ww74oCLhqM0PEUuSQMXz7MVKOeVqTAZ1LKRPNUp 3Ckm1PcnTldWebQlnnyg9nCis+IpT1GseqGXhQAtqhnsQTOM7WQ+XPIvJx1opKDehfWY CQaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=eTS6duZ7HYMOVqsaKeBzBBHUHwiFlkxSpDFXeRbdgN0=; b=hGrcJ7iB8IUa3Z2GJQo4RGgClho4hgL7uv3bYqR+4GDy4Bi5tJeawvEWd5757h+MLf wLi8hnKCVQgjReuvJ2+UhzvaaR6qEJutzguc4MCeyu51sf4m161hYD1+pBwTu9bv7ujX /MOUaovGefXrU7lDkXWbBweOTEvpMuz10rubS8YsbDonuJVOYTdjI2PoA8QPGfpz8WMw baT41db32jtgorX06uPL2S1gVbNqOWRrGm89g0FWVS8blD+3dVpKA8TXC7+NNzOD3YMS +ZehEE/LiN5yQAuWJL8zg3MUms3EPmZq+lLjNMgjFZYqDBlZKm+a4DMRMxaOvgYYjyxs e19g== X-Gm-Message-State: AGRZ1gJ4HyAvCIqgj3HInWWoDyUwR0BF6uwobnJ3w3K2pbhYHJ48TE0j j9ppp8v9K8Ls7FowFSCxHNQWyhXwVNlmrg== X-Google-Smtp-Source: AJdET5fMLBCbauPO1y2+It/Rzs6dQfVe8gFaao2f1PZAJ+f+gtjLM0OogOxMiOzuQGUsXCHw/Nl09w== X-Received: by 2002:a6b:9309:: with SMTP id v9-v6mr2221221iod.239.1542076069390; Mon, 12 Nov 2018 18:27:49 -0800 (PST) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id p22-v6sm5679028iog.3.2018.11.12.18.27.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 18:27:48 -0800 (PST) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> Date: Mon, 12 Nov 2018 21:29:03 -0500 In-Reply-To: (Paul Eggert's message of "Sun, 11 Nov 2018 22:39:56 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174-done Cc: 33174-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: > Thomas Fitzsimmons wrote: >> Actually, EMACS_HEAP_EXEC is true! > > OK, thanks, that explains things. I installed the first attached patch > to the emacs-26 branch as a quick hack to work around the problem, I confirmed this works around the problem on the emacs-26 branch with EMACS_HEAP_EXEC set in the initial build environment, and confirmed that the build still works without it set. > and the second attached patch to the master branch to come up with a > better way to address the underlying issue that doesn't involve > fiddling with environment variables. Please let us know if this > doesn't work for your platform, as I've tested this only on x86-64. Likewise this fixes the failure on master on my system with EMACS_HEAP_EXEC set, and the build still works without it set. It looks like the second patch still disables ASLR unconditionally on PPC64. If you want to suggest experiments I can try on my system, maybe I can attempt a fix so that ASLR can be disabled only during dumping on PPC64 like on other archiectures. Or do you know that's an impossibility for some reason? Thanks, Thomas From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 13 09:42:53 2018 Received: (at 33174-done) by debbugs.gnu.org; 13 Nov 2018 14:42:53 +0000 Received: from localhost ([127.0.0.1]:48705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMZu0-0000A8-Pf for submit@debbugs.gnu.org; Tue, 13 Nov 2018 09:42:52 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMZty-00009t-0x for 33174-done@debbugs.gnu.org; Tue, 13 Nov 2018 09:42:51 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 09A531600EF; Tue, 13 Nov 2018 06:42:44 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id zKt9ZZecUh2u; Tue, 13 Nov 2018 06:42:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 071581600F4; Tue, 13 Nov 2018 06:42:43 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Wab0OeenPFlb; Tue, 13 Nov 2018 06:42:42 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D17C61600EF; Tue, 13 Nov 2018 06:42:42 -0800 (PST) Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le To: Thomas Fitzsimmons References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <0de7486c-04d1-a13d-4490-b79c4b8f68e2@cs.ucla.edu> Date: Tue, 13 Nov 2018 06:42:42 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------7D69903DF402EC067CC56D94" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33174-done Cc: 33174-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------7D69903DF402EC067CC56D94 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thomas Fitzsimmons wrote: > It looks like the second patch still disables ASLR unconditionally on > PPC64. If you want to suggest experiments I can try on my system, maybe > I can attempt a fix so that ASLR can be disabled only during dumping on > PPC64 like on other archiectures. Or do you know that's an > impossibility for some reason? I don't recall the reason that ppc64 is different, but you can experiment by applying the attached patch. To help with the detective work you might look at the thread containing this email: https://sourceware.org/ml/libc-alpha/2016-07/msg00538.html --------------7D69903DF402EC067CC56D94 Content-Type: text/x-patch; name="ppc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ppc.diff" diff --git a/src/sysdep.c b/src/sysdep.c index ddcb594f66..71aa63a1c0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -164,9 +164,6 @@ maybe_disable_address_randomization (bool dumping, int argc, char **argv) if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0) { bool disable_aslr = dumping; -# ifdef __PPC64__ - disable_aslr = true; -# endif exec_personality = disable_aslr ? personality (0xffffffff) : -1; if (exec_personality & ADDR_NO_RANDOMIZE) exec_personality = -1; --------------7D69903DF402EC067CC56D94-- From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 18 22:12:30 2018 Received: (at 33174-done) by debbugs.gnu.org; 19 Nov 2018 03:12:30 +0000 Received: from localhost ([127.0.0.1]:59558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOZzB-0005f3-Qk for submit@debbugs.gnu.org; Sun, 18 Nov 2018 22:12:30 -0500 Received: from mail-it1-f177.google.com ([209.85.166.177]:33511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOZz8-0005eo-G4 for 33174-done@debbugs.gnu.org; Sun, 18 Nov 2018 22:12:28 -0500 Received: by mail-it1-f177.google.com with SMTP id p11-v6so6252538itf.0 for <33174-done@debbugs.gnu.org>; Sun, 18 Nov 2018 19:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zJP0ZYDSJiD7OLS6oLubLxKdYuiXsUv0rY0DpDS7oO8=; b=qKx/JnAyPL3HE24JO7/TImOd4hqd9yRCG18iI5vyiwJwoD7ocJtcaBL//Hc8gQMqvf F4JQHHb045I34PTDbG7XLTCK+MD+bKSMdQuID9OEo+NV/WiONyRw4l9YvoMFEFZ9XnVL mYx1/yg5ObCBlzAy3xQ0azrNjz6JIwC/y4de+BFw+DByrHxGm6bTQ6YPpm3LhhlgLuOB hR9oULvYSJwONiyMKGnqhGUFEvJ0oJWXn0VMaHUEk6nc6igxu/88/hAiEK0QcXskk41i CsPLxIINbg+y/IEzi8YHbarSNhEzo3pIG3ADGLVYX1V/TkR8C8p1BTfJkwQeFx7U7KyG HxVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=zJP0ZYDSJiD7OLS6oLubLxKdYuiXsUv0rY0DpDS7oO8=; b=G30HYJTmI5FLwOzjj+L3RcL6/Az7ZRTsNCTQRVTBmbNgD8PXHkLYqA36FanCitPRM9 QcNsN7bRAVuh4QJSyHCDFtoDCzEjKZhp3waYaGadcHvioYOTs7e1AEYEKw2VBh9cfgjJ 3HwwSnJPxqUM72W1WSr3CFhGQPizvAtM772YMlV1fXBYCq4FeWujj8SzDZtrIgxAdYss /Rmqam1uQiCphHbpAUjKjBMu8aROU7Fc8+Sl4+6q+myEzhQnwGDZJee8DZfInwK9yO3g PWeZeemHmTZv1PR4fFootGSMUe/CLjQ3pOlg/G0Gyo5SS1MhSW+IjaMALopoNAj/XWdu LqCQ== X-Gm-Message-State: AGRZ1gICWV2yr2VV/dnkjYfOjADh47zMEzBwywL8+gsmQXu/o86Q3QIB H+qC8s0kYxRVPtSF1b72tkThQu77xcTzrw== X-Google-Smtp-Source: AJdET5egNu34JaQ8J4RZtAECq2NPeTsRmw5+2pcQw5vsdJRXzb0r4e5FOGsWaDbo4ecWSzwcgt2f6g== X-Received: by 2002:a02:a98e:: with SMTP id q14-v6mr17650535jam.109.1542597140564; Sun, 18 Nov 2018 19:12:20 -0800 (PST) Received: from localhost.localdomain (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id i135sm8319823iti.34.2018.11.18.19.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Nov 2018 19:12:19 -0800 (PST) From: Thomas Fitzsimmons To: Paul Eggert Subject: Re: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> <0de7486c-04d1-a13d-4490-b79c4b8f68e2@cs.ucla.edu> Date: Sun, 18 Nov 2018 22:14:44 -0500 In-Reply-To: <0de7486c-04d1-a13d-4490-b79c4b8f68e2@cs.ucla.edu> (Paul Eggert's message of "Tue, 13 Nov 2018 06:42:42 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 33174-done Cc: 33174-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Paul Eggert writes: > Thomas Fitzsimmons wrote: >> It looks like the second patch still disables ASLR unconditionally on >> PPC64. If you want to suggest experiments I can try on my system, maybe >> I can attempt a fix so that ASLR can be disabled only during dumping on >> PPC64 like on other archiectures. Or do you know that's an >> impossibility for some reason? > > I don't recall the reason that ppc64 is different, but you can > experiment by applying the attached patch. To help with the detective > work you might look at the thread containing this email: > > https://sourceware.org/ml/libc-alpha/2016-07/msg00538.html I read through that thread, then tried the patch. I was surprised that everything seems to work: - Bootstrap works within a reasonable amount of RAM (limited with ulimit -d to make sure it didn't spike up to 12 GB). - The Emacs process (run as ./src/emacs from the build directory): - does not use 12 GB of RAM (i.e., RAM usage is reasonable after opening a C file, src/xdisp.c). - has a /proc//personality value of 00000000. - runs subprocesses with a /proc/self/personality value of 00000000. My system has glibc 2.24. src/config.h has "#define HYBRID_MALLOC 1". Hybrid malloc was proposed as a proper fix during that discussion, but wasn't enabled by default at the time. Given that I configured with just "./configure --with-x-toolkit=lucid", it seems that hybrid malloc is enabled by default now. I'm not sure if this would now work on older glibc versions as well, but in case it doesn't, what about something like the attached for master? Are there other tests I should try, to reveal problems? If the patch looks OK, I should probably also test it on Fedora as part of a local Rawhide Emacs package build, since lots of the discussion was about getting that working reliably. Thanks, Thomas --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Enable-ASLR-on-PPC64-glibc-versions-2.24.patch >From d69509b909bc35b0908e40a9be741e9ef38b3402 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sun, 18 Nov 2018 11:07:49 -0500 Subject: [PATCH] Enable ASLR on PPC64 when glibc version is >= 2.24 * src/sysdep.c (maybe_disable_address_randomization): Disable randomization on PPC64 only when glibc version is less than 2.24. --- src/sysdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sysdep.c b/src/sysdep.c index ddcb594f66..1a863e65ab 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -164,7 +164,8 @@ maybe_disable_address_randomization (bool dumping, int argc, char **argv) if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0) { bool disable_aslr = dumping; -# ifdef __PPC64__ +# if defined(__PPC64__) \ + && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) disable_aslr = true; # endif exec_personality = disable_aslr ? personality (0xffffffff) : -1; -- 2.11.0 --=-=-=-- From unknown Sun Aug 17 22:12:19 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 17 Dec 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator