public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libmudflap/38766] New: mudflap cannot detect errors on stack of nptl thread
@ 2009-01-08 15:54 anemo at mba dot ocn dot ne dot jp
2009-10-07 8:33 ` [Bug libmudflap/38766] " chris dot smith at st dot com
2010-05-06 6:23 ` anemo at mba dot ocn dot ne dot jp
0 siblings, 2 replies; 4+ messages in thread
From: anemo at mba dot ocn dot ne dot jp @ 2009-01-08 15:54 UTC (permalink / raw)
To: gcc-bugs
The mudflap do not report an error in this func() when called from
NPTL thread. Same error on main thread is reported as expected.
#include <pthread.h>
void *func(void *arg)
{
void *a[1];
return a[2];
}
int main(int argc, char **argv)
{
pthread_t tid;
pthread_create(&tid, NULL, func, NULL);
pthread_join(tid, NULL);
return (int)func(NULL);
}
$ gcc -fmudflapth foo.c -lmudflapth -lpthread
$ ./a.out
*******
mudflap violation 1 (check/read): time=1231413729.194138 ptr=0xbfcc9030 size=12
pc=0x1f92a0 location=`foo.c:6:2 (func)'
/usr/lib/libmudflapth.so.0(__mf_check+0x50) [0x1f92a0]
./a.out(func+0x97) [0x804884b]
./a.out(main+0x77) [0x80488e8]
Nearby object 1: checked region begins 0B into and ends 8B after
mudflap object 0x9a5ae88: name=`foo.c:5:8 (func) a'
bounds=[0xbfcc9030,0xbfcc9033] size=4 area=stack check=3r/0w liveness=3
alloc time=1231413729.194135 pc=0x1f89c0 thread=3087742672
number of nearby objects: 1
$ rpm -q gcc
gcc-4.3.0-8.i386
With -trace-calls:
$ MUDFLAP_OPTIONS=-trace-calls ./a.out
mf(3086894800): set options from `-trace-calls'
...
mf(3086894800): pthread_create
mf(3086894800): mmap
mf(3086894800): register ptr=0xb75e3000 size=4096 type=2 name='mmap page'
...
mf(3086894800): register ptr=0xb7fe3000 size=4096 type=2 name='mmap page'
mf(3086894800): calloc
mf(3086894800): register ptr=0x9830cb8 size=144 type=2 name='calloc region'
mf(3086891920): register ptr=0xb7fe3b54 size=4 type=5 name='errno area
(thread)'
mf(3086891920): register ptr=0xb7fe3370 size=4 type=3 name='foo.c:5:8 (func) a'
mf(3086891920): check ptr=0xb7fe3370 b=220 size=12 read location=`foo.c:6:2
(func)'
mf(3086891920): unregister ptr=0xb7fe3370 size=4 type=3
mf(3086891920): unregister ptr=0xb7fe3b54 size=4 type=5
mf(3086891920): free
mf(3086894800): register ptr=0xbf9f9540 size=4 type=3 name='foo.c:5:8 (func) a'
mf(3086894800): check ptr=0xbf9f9540 b=336 size=12 read location=`foo.c:6:2
(func)'
mf(3086894800): violation pc=0x1f92a0 location=foo.c:6:2 (func) type=1
ptr=0xbf9f9540 size=12
*******
mudflap violation 1 (check/read): time=1231413750.233228 ptr=0xbf9f9540 size=12
pc=0x1f92a0 location=`foo.c:6:2 (func)'
...
As this log shows, "ptr=0xb7fe3370 size=12" does not cause violation
because stack of NPTL thread is in mmapped area.
In the past, it seems mudflap wrapper for pthread_create allocate its
own thread stack, but the code was removed a while ago.
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01100.html
I'm not sure this problem could happen at that time.
--
Summary: mudflap cannot detect errors on stack of nptl thread
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libmudflap
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anemo at mba dot ocn dot ne dot jp
GCC target triplet: *-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38766
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <bug-38766-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2013-11-10 5:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-08 15:54 [Bug libmudflap/38766] New: mudflap cannot detect errors on stack of nptl thread anemo at mba dot ocn dot ne dot jp
2009-10-07 8:33 ` [Bug libmudflap/38766] " chris dot smith at st dot com
2010-05-06 6:23 ` anemo at mba dot ocn dot ne dot jp
[not found] <bug-38766-4@http.gcc.gnu.org/bugzilla/>
2013-11-10 5:44 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).