[Bug libmudflap/37927] New: Mudflap : invalid reads when accessing static objects in shared libraries
polettog at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 27 10:47:00 GMT 2008
Mudflap reports a read violation when accessing to internal static objects like
character arrays returned by public functions of shared libraries, if those
libraries were not instrumented by mudflap (e g : the system's libc).
The libc's setlocale() for example, can return an internal static read only
string if the locale is set to "C" or "POSIX", then mudflap complains when
reading characters pointed by the return of setlocale().
I don't know if it's a bug or if mudflap didn't intend to manage this, but it
would be nice to get rid of this error while keeping the reading checks on (so
i've set the severity to "enhancement").
Test case : (files will be attached next)
$ gcc -std=gnu99 -Wall -W -fPIC -c testmodule.c -o testmodule.o
$ gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 testmodule.o
$ ln -sf libctest.so.1.0 libctest.so.1
$ ln -sf libctest.so.1.0 libctest.so
$ gcc -std=gnu99 -Wall -W -fmudflap testmain.c -L. -lctest -lmudflap -rdynamic
-o testmain
$ LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
$ ./testmain
*******
mudflap violation 1 (check/read): time=1225103906.196247 ptr=0x809464 size=1
pc=0x49aecd location=`testmain.c:16:9 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x3d) [0x49aecd]
./testmain(main+0x8c) [0x80487d0]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0x49a969]
number of nearby objects: 0
"Abc"
*******
mudflap violation 2 (check/read): time=1225103906.196504 ptr=0x809468 size=8
pc=0x49aecd location=`testmain.c:25:5 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x3d) [0x49aecd]
./testmain(main+0x12a) [0x804886e]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0x49a969]
number of nearby objects: 0
*******
mudflap violation 3 (check/read): time=1225103906.196562 ptr=0x809468 size=4
pc=0x49aecd location=`testmain.c:25:5 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x3d) [0x49aecd]
./testmain(main+0x1a9) [0x80488ed]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0x49a969]
number of nearby objects: 0
34 42
--
Summary: Mudflap : invalid reads when accessing static objects in
shared libraries
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: libmudflap
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: polettog at gmail dot com
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37927
More information about the Gcc-bugs
mailing list