summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-23 21:26:47 +0000
committerphk <phk@FreeBSD.org>2003-01-23 21:26:47 +0000
commit8d433414eb1290d73940f56d046dc891b4543563 (patch)
tree331b77e585bc318bc854e39adcac63726c61994a /lib/libc
parentde0591cf0727b845429e1683e6dd5f20d8885ef4 (diff)
downloadFreeBSD-src-8d433414eb1290d73940f56d046dc891b4543563.zip
FreeBSD-src-8d433414eb1290d73940f56d046dc891b4543563.tar.gz
For "sensitive" processes, we always set the 'A' flag which causes abort()
to be called on first sight of trouble. "sensitive" is somewhat arbitrarily defined as "setuid, setgid, uid == root or gid == wheel". The 'A' option carries no performance penalty. It is not possible to override this setting: fix the program instead. Absentmindedly nodded OK to by: various
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index fdcc751..3cd58f7 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -465,6 +465,13 @@ malloc_init ()
}
}
+ /*
+ * Sensitive processes, somewhat arbitrarily defined here as setuid,
+ * setgid, root and wheel cannot afford to have malloc mistakes.
+ */
+ if (issetugid() || getuid() == 0 || getgid() == 0)
+ malloc_abort = 1;
+
UTRACE(0, 0, 0);
/*
OpenPOWER on IntegriCloud