This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] .gdbinit security (revived) [incl doc]


Hi,

A long time ago, Daniel posted a patch which would do a security check of .gdbinit files and refuse to execute them if they were untrusted. See http://sourceware.org/ml/gdb-patches/2005-05/msg00637.html . I would like to resurrect that discussion.

At the time, there was some debate about whether simply refusing to read the file was particularly user-unfriendly for a lot of developers. Someone suggested adding an option to override the behavior and so on. Overall, people agreed that doing something was correct.

I have implemented a slightly different option: ask the user if he would like to run the untrusted file any way, much like removing a write-protected file IMO.

Fedora has been using a version of this patch (essentially Daniel's original patch) for several years, and I'm sure that other distros have their own versions, too.

No regressions on x86_64-linux. [mingw32 does not appear to have getuid. It builds without HAVE_GETUID.]

Comments?
Keith

ChangeLog
2010-11-19  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 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.

testsuite/ChangeLog
2010-11-19  Keith Seitz <keiths@redhat.com>

	From Jeff Johnston  <jjohnstn@redhat.com>:
	* gdb.base/gdbinit.sample: New file.
	* gdb.base/gdbinit.exp: New file.


doc/ChangeLog 2010-11-19 Keith Seitz <keiths@redhat.com>

	* gdb.texinfo (Startup): Document security handling of
	.gdbinit files.

Attachment: gdbinit-security.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]