Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@specifix.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: [patch] fileio.exp FAILs if run as root
Date: Tue, 11 Dec 2007 17:46:00 -0000	[thread overview]
Message-ID: <1197393212.32169.63.camel@localhost.localdomain> (raw)
In-Reply-To: <20071208191320.GA11395@host0.dyn.jankratochvil.net>

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 <jan.kratochvil@redhat.com>
> > > 
> > > 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  <jan.kratochvil@redhat.com>
> 
> 	* 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


  reply	other threads:[~2007-12-11 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-08 18:58 Jan Kratochvil
2007-12-08 19:13 ` Mark Kettenis
2007-12-09  1:19   ` Jan Kratochvil
2007-12-11 17:46     ` Michael Snyder [this message]
2007-12-11 17:54       ` Jan Kratochvil
2007-12-11 18:38         ` Daniel Jacobowitz
2007-12-12 16:26           ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1197393212.32169.63.camel@localhost.localdomain \
    --to=msnyder@specifix.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox