From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#12632: file permissions checking mishandled when setuid Date: Tue, 16 Oct 2012 05:46:15 +0200 Message-ID: <83d30j3wqg.fsf@gnu.org> References: <5078CAB6.7020509@cs.ucla.edu> <83fw5i7s4p.fsf@gnu.org> <83a9vq7oqh.fsf@gnu.org> <507A58CC.10209@cs.ucla.edu> <83fw5h5yo6.fsf@gnu.org> <507B010F.20105@cs.ucla.edu> <831uh06gqd.fsf@gnu.org> <507B15B0.2040802@cs.ucla.edu> <83txtw4xmk.fsf@gnu.org> <507B2354.3030408@cs.ucla.edu> <83sj9g4vy7.fsf@gnu.org> <507BAA6C.2000601@cs.ucla.edu> <83lif74p78.fsf@gnu.org> <507C823D.40304@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1350359221 27079 80.91.229.3 (16 Oct 2012 03:47:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Oct 2012 03:47:01 +0000 (UTC) Cc: 12632@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 16 05:47:08 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TNy7W-00013G-Ap for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Oct 2012 05:47:06 +0200 Original-Received: from localhost ([::1]:42873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNy7P-0002Gu-I6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 Oct 2012 23:46:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNy7L-0002G3-6j for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 23:46:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNy7I-0007ly-Az for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 23:46:55 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNy7I-0007lO-56 for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 23:46:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TNy8Q-0003b3-2s for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 23:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Oct 2012 03:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 12632-submit@debbugs.gnu.org id=B12632.135035927813816 (code B ref 12632); Tue, 16 Oct 2012 03:48:02 +0000 Original-Received: (at 12632) by debbugs.gnu.org; 16 Oct 2012 03:47:58 +0000 Original-Received: from localhost ([127.0.0.1]:45982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TNy8L-0003am-Ss for submit@debbugs.gnu.org; Mon, 15 Oct 2012 23:47:58 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:60228) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TNy8H-0003aV-Oj for 12632@debbugs.gnu.org; Mon, 15 Oct 2012 23:47:56 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MBY00700VG47L00@a-mtaout22.012.net.il> for 12632@debbugs.gnu.org; Tue, 16 Oct 2012 05:46:04 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MBY0043JVSSSB71@a-mtaout22.012.net.il>; Tue, 16 Oct 2012 05:46:04 +0200 (IST) In-reply-to: <507C823D.40304@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65652 Archived-At: > Date: Mon, 15 Oct 2012 14:38:05 -0700 > From: Paul Eggert > CC: 12632@debbugs.gnu.org > > On 10/15/2012 10:31 AM, Eli Zaretskii wrote: > > Well, actually I thought we should stay with 'stat'. > > We cannot stay with 'stat' everywhere, since 'stat' does not tell us > whether a file is readable or writeable or executable. We must use > faccessat (or something like it, e.g., euidaccess) when we're > implementing functions like check_writable, check_executable, or > basically any function that uses R_OK, W_OK, or X_OK. I was talking about check_existing. > It's true that we could use 'stat' instead of faccessat(..., F_OK, > ...), but the question then arises, why bother to make a special > case for F_OK? Because it's more universally available, and I believe also more efficient. > > So 'stat' is still better, IMO, because it is very efficient > > Why should 'stat' be more efficient than faccessat? Because it's used a lot.