Red Hat Bugzilla – Bug 474140
electric fence and valgrind reporting problem in regexp glibc
Last modified: 2008-12-05 03:11:44 EST
Description of problem:
When running crystalspace's walktest in electricfence i noticed that it had problem with regexp function from glibc. So I tried to run grep in ef and it reported similar problem.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. ulimit -c xyz; ef grep lala || valgrind --tool=memcheck grep lala
2. you get core open it in gdb or read valgrind output
#0 0x00000033d70331c7 in kill () from /lib64/libc-2.9.so
#1 0x0000000000112235 in ?? () from /usr/lib64/libefence.so.0.0
#2 0x00000000001127cd in EF_Abort () from /usr/lib64/libefence.so.0.0
#3 0x0000000000111d77 in memalign () from /usr/lib64/libefence.so.0.0
#4 0x00000033d70c2900 in analyze () at regcomp.c:1105
#5 re_compile_internal (preg=0x7f446f874fa8, pattern=0x7fff77960523 "lala", length=<value optimized out>, syntax=2822) at regcomp.c:778
#6 0x00000033d70c392b in __re_compile_pattern (pattern=0x7f446f8396e0 "", length=<value optimized out>, bufp=0xfae) at regcomp.c:229
#7 0x000000000040d673 in fflush () at iofflush.c:36
#8 0x0000000000404814 in fflush () at iofflush.c:36
#9 0x00000033d701e546 in __libc_start_main (main=0x403eb0 <fflush+7272>, argc=2, ubp_av=0x7fff7795fba8, init=0x410950, fini=<value optimized out>,
rtld_fini=<value optimized out>, stack_end=0x7fff7795fb98) at libc-start.c:220
#10 0x0000000000402289 in fflush () at iofflush.c:36
#11 0x00007fff7795fb98 in ?? ()
#12 0x000000000000001c in ?? ()
#13 0x0000000000000002 in ?? ()
#14 0x00007fff7796051e in ?? ()
#15 0x00007fff77960523 in ?? ()
#16 0x0000000000000000 in ?? ()
ef reports problem
it shouldn't :)
I cannot reproduce any problem. ef crashes, yes, but that's an ef problem:
ef /bin/grep lala
Electric Fence 2.2.2 Copyright (C) 1987-1999 Bruce Perens <email@example.com>
ElectricFence Aborting: Allocating 0 bytes, probably a bug.
/usr/bin/ef: line 20: 8790 Illegal instruction ( export LD_PRELOAD=libefence.so.0.0; exec "$@" )
Under valgrind I see no problem at all.
The backtrace you show also doesn't indicate a problem in the code. A crash inside ef's memory allocation code can indicate a problem in ef just as well.
You'll have to provide more detailed instructions on how to reproduce the problem.
Allocating 0 bytes, probably a bug.
says it all, not a bug.
By default, Electric Fence traps calls to malloc() with a size of zero, because they are often the result of a software bug. If EF_ALLOW_MALLOC_0 is non-zero, the software will not trap calls to malloc() with a size of zero. To change this value, set EF_ALLOC_MALLOC_0 in the shell environment to an
integer value, or assign to the global integer variable EF_ALLOC_MALLOC_0 using a debugger.
So just use EF_ALLOC_MALLOC_0=0 ef /bin/grep lala