From: Doug Evans <dje@google.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] .gdbinit security (revived) [incl doc]
Date: Tue, 23 Nov 2010 23:19:00 -0000 [thread overview]
Message-ID: <AANLkTi=a2ckZj=z7dWpDFZ6=RawCKC_bLjnfT7+ha9Mg@mail.gmail.com> (raw)
In-Reply-To: <4CEC0757.6000503@redhat.com>
On Tue, Nov 23, 2010 at 10:26 AM, Keith Seitz <keiths@redhat.com> wrote:
> [...]
> ChangeLog
> 2010-11-23 Keith Seitz <keiths@redhat.com>
>
> From Daniel Jacobowitz <dan@codesourcery.com>
> and Jeff Johnston <jjohnstn@redhat.com>:
> * cli/cli-cmds.h (find_and_open_script): Add from_tty argument.
> * cli/cli-cmds.c (find_and_open_script): Likewise. When
> from_tty is -1, perform a security check of the file. If it
> fails, warn the user and whether he wants to read the file anyway.
> (source_script_with_search): Update call to find_and_open_script.
> Only print an error if from_tty is greater than zero.
> * main.c (captured_main): Pass from_tty = -1 when sourcing
> gdbinit files.
> * python/py-auto-load.c (source_section_scripts): Update call
> to find_and_open_script.
>
> doc/ChangeLog
> 2010-11-23 Keith Seitz <keiths@redhat.com>
>
> * gdb.texinfo (Startup): Document security handling of
> .gdbinit files.
Hi.
A few comments inline.
>- catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL);
>+ catch_command_errors (source_script, home_gdbinit, -1, RETURN_MASK_ALL);
I don't mind using -1 for from_tty here (especially if there is
precedent :-)), but a #define/enum would be nicer.
catch_command_errors has a limited API so overloading from_tty is a
pragmatic tradeoff.
Feel free to save for a separate patch. Just mentioning it to prime
the pumps doing something like this down the road.
>+ If FROM_TTY is -1, then this script is being automatically loaded
>+ at runtime, and a security check will be performed on the file
>+ (supported only on hosts with HAVE_GETUID).
We're combining two concepts here: "is the command from the tty?" and
"do security checks?".
IWBN to keep them separate here.
Maybe specify both separately or just have check_security instead of from_tty?
>+ if (statbuf.st_uid != getuid ())
I wonder if you also need to watch for file owner == root (and not
world writable). E.g. scripts like --with-system-gdbinit.
That won't happen with the patch as is, but that feels like a
high-level detail that this function shouldn't have to know about.
Then again, why not do this security check for system.gdbinit too?
> opened = find_and_open_script (file, 1 /*search_path*/,
>- &stream, &full_path);
>+ &stream, &full_path, 1 /* from_tty */);
Passing 1 for from_tty feels wrong here.
If find_and_open_script had a check_security parameter instead of
from_tty, then one could just pass 0 here.
next prev parent reply other threads:[~2010-11-23 23:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 23:10 Keith Seitz
2010-11-20 2:50 ` Jan Kratochvil
2010-11-23 17:15 ` Keith Seitz
2010-11-20 9:45 ` Eli Zaretskii
2010-11-23 18:31 ` Keith Seitz
2010-11-23 19:19 ` Eli Zaretskii
2010-11-23 23:19 ` Doug Evans [this message]
2010-11-30 0:23 ` Keith Seitz
2010-11-24 21:23 ` Jan Kratochvil
2010-11-24 21:27 ` Keith Seitz
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='AANLkTi=a2ckZj=z7dWpDFZ6=RawCKC_bLjnfT7+ha9Mg@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
/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