From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7057 invoked by alias); 11 Dec 2007 17:29:23 -0000 Received: (qmail 7048 invoked by uid 22791); 11 Dec 2007 17:29:22 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Dec 2007 17:29:13 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id 646853BF2B; Tue, 11 Dec 2007 09:29:11 -0800 (PST) Subject: Re: [patch] fileio.exp FAILs if run as root From: Michael Snyder To: Jan Kratochvil Cc: Mark Kettenis , gdb-patches@sourceware.org In-Reply-To: <20071208191320.GA11395@host0.dyn.jankratochvil.net> References: <20071208181422.GA10275@host0.dyn.jankratochvil.net> <200712081858.lB8Iw5pn014666@brahms.sibelius.xs4all.nl> <20071208191320.GA11395@host0.dyn.jankratochvil.net> Content-Type: text/plain Date: Tue, 11 Dec 2007 17:46:00 -0000 Message-Id: <1197393212.32169.63.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00160.txt.bz2 On Sat, 2007-12-08 at 20:13 +0100, Jan Kratochvil wrote: > On Sat, 08 Dec 2007 19:58:05 +0100, Mark Kettenis wrote: > > > Date: Sat, 8 Dec 2007 19:14:22 +0100 > > > From: Jan Kratochvil > > > > > > Hi, > > > > > > if you run gdb.base/fileio.exp as UID 0 it will print: > > > FAIL: gdb.base/fileio.exp: Open for write but no write permission returns EACCES > > > FAIL: gdb.base/fileio.exp: Unlinking a file in a directory w/o write access returns EACCES > > > > People running the testsuite as root deserve what they get. I don't > > think we should complicate our code to make that possible, especially > > if it involves calling setuid() which is notoriously unportable. > > OK, this is the other possibility I was considering. Clever -- but should it be a warning instead of a terminate? Somebody might have a legitimate reason to run as root, even if we can't think of it right now. > plain text document attachment (gdb-run-root.patch) > 2007-12-08 Jan Kratochvil > > * lib/gdb.exp: Refuse to run as root. > > --- ./gdb/testsuite/lib/gdb.exp 30 Oct 2007 19:23:18 -0000 1.92 > +++ ./gdb/testsuite/lib/gdb.exp 8 Dec 2007 19:12:00 -0000 > @@ -26,6 +26,14 @@ if {$tool == ""} { > exit 2 > } > > +set uidfile [open "|id -u" r]; > +gets $uidfile uid > +catch {close $uidfile} > +if {$uid == 0} { > + send_error "Root privileges give false results, run as a regular user!\n" > + exit 2 > +} > + > load_lib libgloss.exp > > global GDB