From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27106 invoked by alias); 6 Jun 2013 16:53:01 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 27049 invoked by uid 48); 6 Jun 2013 16:52:57 -0000 From: "fcollyer at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug malloc/15592] New: mtrace.c tr_break() is not called from malloc hooks Date: Thu, 06 Jun 2013 16:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: malloc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fcollyer at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00046.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15592 Bug ID: 15592 Summary: mtrace.c tr_break() is not called from malloc hooks Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: malloc Assignee: unassigned at sourceware dot org Reporter: fcollyer at gmail dot com Looking at some dumps generated on a CentOS 5.6, it seems as if gcc is optimizing away some calls to tr_break(). Everything is in place (according to the file instructions), but tr_break() is not firing after setting its breakpoint. Small gdb disasm from glibc-2.5x: Dump of assembler code for function tr_freehook: 0x0066ffc0 : push %ebp 0x0066ffc1 : mov %esp,%ebp 0x0066ffc3 : sub $0x18,%esp 0x0066ffc6 : mov 0x8(%ebp),%eax 0x0066ffc9 : mov %ebx,-0xc(%ebp) 0x0066ffcc : call 0x616ce0 <__i686.get_pc_thunk.bx> 0x0066ffd1 : add $0xd3023,%ebx 0x0066ffd7 : mov %esi,-0x8(%ebp) 0x0066ffda : test %eax,%eax 0x0066ffdc : mov %edi,-0x4(%ebp) 0x0066ffdf : je 0x6700a4 0x0066ffe5 : xor %edi,%edi 0x0066ffe7 : mov $0x1,%esi 0x0066ffec : mov %edi,%eax 0x0066ffee : mov %esi,%ecx 0x0066fff0 : cmpl $0x0,%gs:0xc 0x0066fff8 : je 0x66fffb 0x0066fffa : lock cmpxchg %ecx,0x1648(%ebx) 0x00670002 : jne 0x67040c <_L_lock_464> 0x00670008 : mov 0xc(%ebp),%eax 0x0067000b : call 0x66fe70 0x00670010 : mov 0x8(%ebp),%eax 0x00670013 : mov %eax,0x8(%esp) 0x00670017 : lea -0x1b2a9(%ebx),%eax 0x0067001d : mov %eax,0x4(%esp) 0x00670021 : mov 0x1640(%ebx),%eax 0x00670027 : mov %eax,(%esp) 0x0067002a : call 0x646e20 0x0067002f : cmpl $0x0,%gs:0xc 0x00670037 : je 0x67003a 0x00670039 : lock subl $0x1,0x1648(%ebx) 0x00670041 : jne 0x67041c <_L_unlock_481> ---Type to continue, or q to quit--- 0x00670047 : mov %edi,%eax 0x00670049 : mov %esi,%ecx 0x0067004b : cmpl $0x0,%gs:0xc 0x00670053 : je 0x670056 0x00670055 : lock cmpxchg %ecx,0x1648(%ebx) 0x0067005d : jne 0x67042c <_L_lock_490> 0x00670063 : mov 0x164c(%ebx),%eax 0x00670069 : mov -0x38(%ebx),%esi 0x0067006f : test %eax,%eax 0x00670071 : mov %eax,(%esi) 0x00670073 : je 0x6700b1 0x00670075 : mov 0xc(%ebp),%edx 0x00670078 : mov %edx,0x4(%esp) 0x0067007c : mov 0x8(%ebp),%edx 0x0067007f : mov %edx,(%esp) 0x00670082 : call *%eax 0x00670084 : lea -0xd3034(%ebx),%eax 0x0067008a : mov %eax,(%esi) 0x0067008c : cmpl $0x0,%gs:0xc 0x00670094 : je 0x670097 0x00670096 : lock subl $0x1,0x1648(%ebx) 0x0067009e : jne 0x67043c <_L_unlock_517> 0x006700a4 : mov -0xc(%ebp),%ebx 0x006700a7 : mov -0x8(%ebp),%esi 0x006700aa : mov -0x4(%ebp),%edi 0x006700ad : mov %ebp,%esp 0x006700af : pop %ebp 0x006700b0 : ret 0x006700b1 : mov 0x8(%ebp),%eax 0x006700b4 : mov %eax,(%esp) 0x006700b7 : call 0x66a990 0x006700bc : jmp 0x670084 End of assembler dump. This can be mapped to the corresponding source-code: http://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/mtrace.c;h=1a9522b09de37f96fb9e4ed807f3cc1dedaca3fb;hb=88cc61e84e8e75e6e91b1a2e51147aeb63712ff8 146 tr_where (caller); 147 /* Be sure to print it first. */ 148 fprintf (mallstream, "- %p\n", ptr); 149 __libc_lock_unlock (lock); 150 if (ptr == mallwatch) 151 tr_break (); 152 __libc_lock_lock (lock); Inlined gcc tls lock code around tr_break() seems to be ok. tr_break() related code seems to be missing. -- You are receiving this mail because: You are on the CC list for the bug.