From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le Date: Mon, 29 Oct 2018 22:58:19 -0700 Organization: UCLA Computer Science Department Message-ID: <9fbbce6a-ca72-e4e2-1456-49e146542896@cs.ucla.edu> References: <39df62a1-58fb-0e5c-88a6-3eaae4e865d4@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1540879027 11500 195.159.176.226 (30 Oct 2018 05:57:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 05:57:07 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 Cc: 33174@debbugs.gnu.org To: Thomas Fitzsimmons Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 30 06:57:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHN1S-0002th-Re for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2018 06:57:03 +0100 Original-Received: from localhost ([::1]:50983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHN3Z-0008No-E1 for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Oct 2018 01:59:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHN3T-0008Nd-Cz for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 01:59:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHN3O-0007fv-4L for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 01:59:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48861) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHN3O-0007fk-0Y for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 01:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gHN3N-0000fO-Ue for bug-gnu-emacs@gnu.org; Tue, 30 Oct 2018 01:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2018 05:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33174 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33174-submit@debbugs.gnu.org id=B33174.15408791092522 (code B ref 33174); Tue, 30 Oct 2018 05:59:01 +0000 Original-Received: (at 33174) by debbugs.gnu.org; 30 Oct 2018 05:58:29 +0000 Original-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 Original-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 Original-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) Original-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) Original-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 Original-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) Original-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) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151808 Archived-At: 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.