grep bug
Bruce Evans
bde at zeta.org.au
Mon Feb 9 15:19:00 PST 2004
On Mon, 9 Feb 2004, Stefan Farfeleder wrote:
> On Sun, Feb 08, 2004 at 06:36:23PM -0800, Kris Kennaway wrote:
> > kkenn at rot13:~ grep -r foo / > /dev/null
> > grep: /dev/network: Permission denied
> > grep: /dev/geom.ctl: Permission denied
> > grep: /dev/devctl: Permission denied
> > grep: /dev/ata: Permission denied
> > grep: /dev/console: Permission denied
> > grep in realloc(): error: allocation failed
> > ^C^C^CAbort (core dumped)
>
> -current aborts by default on memory allocation failures, you have to
> set the 'a' flag via MALLOC_OPTIONS or /etc/malloc.conf.
I have this turned off in /etc/malloc.conf, but turning it off has been
broken for about a year for user root and group wheel:
%%%
Index: malloc.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/stdlib/malloc.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -2 -r1.72 -r1.73
--- malloc.c 21 Aug 2002 17:11:00 -0000 1.72
+++ malloc.c 23 Jan 2003 21:26:47 -0000 1.73
@@ -10,5 +10,5 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.72 2002/08/21 17:11:00 phk Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.73 2003/01/23 21:26:47 phk Exp $");
/*
@@ -465,4 +465,11 @@
}
}
+
+ /*
+ * 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);
%%%
This code is executed after parsing MALLOC_OPTIONS etc., so there is no
way to override it.
Bruce
More information about the freebsd-current
mailing list