From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#34180: 27.0.50; argv[0] used incorrectly to find the .pdmp Date: Sun, 27 Jan 2019 17:23:46 +0200 Message-ID: <83va2a3z0d.fsf@gnu.org> References: <5d5d6da7-d0d4-82ae-8034-78d47a6b12c8@dancol.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="66715"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 34180@debbugs.gnu.org, monnier@IRO.UMontreal.CA To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 27 16:25:26 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnmJJ-000HEg-2d for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 16:25:25 +0100 Original-Received: from localhost ([127.0.0.1]:46980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnmJI-0005ge-0h for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 10:25:24 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnmIx-0005RG-00 for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 10:25:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnmIw-0005s2-8d for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 10:25:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48441) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnmIw-0005rd-4q for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 10:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gnmIv-0007b8-JH for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 10:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Jan 2019 15:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34180 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 34180-submit@debbugs.gnu.org id=B34180.154860265129143 (code B ref 34180); Sun, 27 Jan 2019 15:25:01 +0000 Original-Received: (at 34180) by debbugs.gnu.org; 27 Jan 2019 15:24:11 +0000 Original-Received: from localhost ([127.0.0.1]:47721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnmI7-0007Zz-LE for submit@debbugs.gnu.org; Sun, 27 Jan 2019 10:24:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnmI5-0007Zk-J9 for 34180@debbugs.gnu.org; Sun, 27 Jan 2019 10:24:10 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnmHz-0004tM-5c; Sun, 27 Jan 2019 10:24:03 -0500 Original-Received: from [176.228.60.248] (port=2464 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gnmHy-0003de-P6; Sun, 27 Jan 2019 10:24:03 -0500 In-reply-to: <5d5d6da7-d0d4-82ae-8034-78d47a6b12c8@dancol.org> (message from Daniel Colascione on Sat, 26 Jan 2019 19:54:29 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154814 Archived-At: > From: Daniel Colascione > Date: Sat, 26 Jan 2019 19:54:29 -0800 > > > 1- It fails miserably if argv[0] is a name relative to $PATH since it > > performs the lookup relative to $PWD instead, which is additionally > > a security issue. > > > > 2- If the executable named by argv[0] is a symlink, it does not try to > > follow the symlink in case the .pdmp is stored next to the > > destination rather than next to the source. > > Yep. We should definitely fix that. realpath on argv[0] seems like the > right thing. Wouldn't it be better to have a method of finding the absolute file name of the executable from which the process was started, regardless of what argv[0] says? The way to do that is system-dependent (on GNU/Linux, I believe you need to readlink ("/proc/self/exe") or somesuch, for example), but AFAIK this can be done on all platforms we support.