aboutsummaryrefslogtreecommitdiff
path: root/libmudflap
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2009-09-22 16:17:50 +0000
committerFrank Ch. Eigler <fche@redhat.com>2009-09-22 16:17:50 +0000
commit0c0514f02ad90f82331cdf1919580749ec5af93a (patch)
tree915871f786aef584174d4a4ecfbc78dd8d483e49 /libmudflap
parent891b24573e35cae4f7768686bd67c784a2956c89 (diff)
2009-09-22 Frank Ch. Eigler <fche@redhat.com>
PR libmudflap/41433 * mf-runtime.c (__mf_init): Ignore $MUDFLAP_OPTIONS if running setuid or setgid. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@152026 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmudflap')
-rw-r--r--libmudflap/ChangeLog6
-rw-r--r--libmudflap/mf-runtime.c13
2 files changed, 17 insertions, 2 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index e51c109bbac..f65cf2ab3d3 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-22 Frank Ch. Eigler <fche@redhat.com>
+
+ PR libmudflap/41433
+ * mf-runtime.c (__mf_init): Ignore $MUDFLAP_OPTIONS if
+ running setuid or setgid.
+
2009-09-01 Loren J. Rittle <ljrittle@acm.org>
* mf-runtime.c (__mf_init): Support FreeBSD.
diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c
index 3bfaf02b6a0..08a50c21807 100644
--- a/libmudflap/mf-runtime.c
+++ b/libmudflap/mf-runtime.c
@@ -303,6 +303,14 @@ __mf_set_default_options ()
#ifdef LIBMUDFLAPTH
__mf_opts.thread_stack = 0;
#endif
+
+ /* PR41443: Beware that the above flags will be applied to
+ setuid/setgid binaries, and cannot be overriden with
+ $MUDFLAP_OPTIONS. So the defaults must be non-exploitable.
+
+ Should we consider making the default violation_mode something
+ harsher than viol_nop? OTOH, glibc's MALLOC_CHECK_ is disabled
+ by default for these same programs. */
}
static struct mudoption
@@ -442,7 +450,7 @@ __mf_usage ()
"This is a %s%sGCC \"mudflap\" memory-checked binary.\n"
"Mudflap is Copyright (C) 2002-2009 Free Software Foundation, Inc.\n"
"\n"
- "The mudflap code can be controlled by an environment variable:\n"
+ "Unless setuid, a program's mudflap options be set by an environment variable:\n"
"\n"
"$ export MUDFLAP_OPTIONS='<options>'\n"
"$ <mudflapped_program>\n"
@@ -711,7 +719,8 @@ __mf_init ()
__mf_set_default_options ();
- ov = getenv ("MUDFLAP_OPTIONS");
+ if (getuid () == geteuid () && getgid () == getegid ()) /* PR41433, not setuid */
+ ov = getenv ("MUDFLAP_OPTIONS");
if (ov)
{
int rc = __mfu_set_options (ov);