Closed GoogleCodeExporter closed 9 years ago
I think I see the same issue on Ubuntu 12.10 (with a patched glibc to resolve a
deadlock issue).
I was able to capture a backtrace using gdb:
#0 0x00007ffff70a5445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1 0x00007ffff70a8bab in abort () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#2 0x00007ffff7b86d98 in HeapLeakChecker_AfterDestructors () at
src/heap-checker.cc:2315
l = {lock_ = 0x7ffff7db2d60}
#3 0x00007ffff70aad3d in __cxa_finalize () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#4 0x00007ffff7b78883 in __do_global_dtors_aux () from
.libs/libtcmalloc_debug.so.4
No symbol table info available.
#5 0x00007fffffffdba0 in ?? ()
No symbol table info available.
#6 0x00007ffff7de990e in ?? () from /lib64/ld-linux-x86-64.so.2
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Original comment by ringo.p...@gmail.com
on 24 Jul 2012 at 7:04
ptrace default behaviour did change in 10.10 onwards:
https://wiki.ubuntu.com/Security/Features#ptrace
Setting the ptrace scope to be more permissive removed the:
Thread finding failed with -1 errno=1
Could not find thread stacks. Will likely report false leak positives.
error messages but the unittest still aborts with:
Check failed: !do_main_heap_check: should have done it
Aborted (core dumped)
Original comment by ringo.p...@gmail.com
on 24 Jul 2012 at 11:42
Do you have a patch you can share for fixing the ptrace issue? As for the other
problem, I ran into this a while back while doing some FreeBSD porting work:
http://code.google.com/p/gperftools/issues/detail?id=375
Applying the same work around as in issue 375 gets things working again. Seems
to be an issue with how things are being ordered/executed by __at_exit.
Original comment by chapp...@gmail.com
on 24 Jul 2012 at 3:58
Not yet - I just used yama to set ptrace to be more permissive at the system
level which is obviously not a long term fix.
I'll try the workaround in issue 375 as well - thanks for the pointer.
Original comment by ringo.p...@gmail.com
on 24 Jul 2012 at 4:47
Interestingly the ptrace permissions don't effect the results of the unittest -
but I suspect that it will create problems.
Original comment by ringo.p...@gmail.com
on 24 Jul 2012 at 5:11
I did a quick hacky test a while back to see if the programatic approach works
for setting permissions and it does:
prctl(PR_SET_PTRACER, debugger_pid, 0, 0, 0)
Haven't had time to work out the details though since it requires some form of
interprocess syncronization. We only get the pid after spawning the child
process that is going to ptrace us. So we need a way to tell the child to wait
until we have given it sufficient permissions. Feel free to press forward with
a patch if you have cycles :)
Original comment by chapp...@gmail.com
on 24 Jul 2012 at 5:20
This is the system level fix for the ptrace permissions:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
This does make the test suite run reliably; I will take a look at a fix in the
code base but this won't be for a few days.
Original comment by ringo.p...@gmail.com
on 24 Jul 2012 at 5:23
OK; this is a first stab at a patch which I think resolves this issue.
It uses base/simple_mutex.h to facilitate sync between the parent and child
threads to ensure that appropriate ptrace permissions are set before the child
thread interrogates the parent.
Original comment by ringo.p...@gmail.com
on 25 Jul 2012 at 1:31
Attachments:
Note that I am also running test with
a) a patched version of glibc 2.15 on Ubuntu 12.10 (this fix should land in
both 12.10 and 12.04 - see http://pad.lv/1028038)
b) the attached patch to ensure that heap check always occurs after destructors
otherwise I see the same issue as seen on FreeBSD.
Original comment by ringo.p...@gmail.com
on 25 Jul 2012 at 1:37
Attachments:
Revised patch which uses semaphore directly so that we have more control over
creation and destruction.
Original comment by ringo.p...@gmail.com
on 28 Jul 2012 at 8:58
Attachments:
Thank you very much for the patches. I have applied and tested on Ubuntu 11.04.
Patches are now committed to the main trunk.
------------------------------------------------------------------------
r152 | chappedm@gmail.com | 2012-09-17 20:00:20 -0400 (Mon, 17 Sep 2012) | 12
lines
issue-437 Fixed issues related to new glibc shipped with Ubuntu 10.10
1. ptrace permissions were modifed to be a bit more strict which required
us to programatically set the permissions while syncing up to the profiling
thread.
2. Order of destructors registered with atexit changed which was casuing us to
miss generating the backtrace when heap checker was finished. Seems that we
initially fixed this for FreeBSD and now linux has changed their behaviour
to be the same. We are now a bit stricter on the rules here accross all
platforms.
------------------------------------------------------------------------
Original comment by chapp...@gmail.com
on 18 Sep 2012 at 12:14
Issue 432 has been merged into this issue.
Original comment by chapp...@gmail.com
on 23 Dec 2012 at 3:10
Issue 500 has been merged into this issue.
Original comment by chapp...@gmail.com
on 10 Mar 2013 at 8:38
Original issue reported on code.google.com by
chapp...@gmail.com
on 9 Jun 2012 at 2:28