Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
When 'ltrace -f' is run on a binary which uses pointers in the thread function, the ltrace dies with 134 errorcode.
======= Here is the nesty thread function: ========
void *TaskCode(void *argument)
{
unsigned int a = 0xDEADBEEF;
unsigned int *ptr = &a;
printf("I am a thread... a = %u *ptr = %u ptr = %p \n", a, *ptr, ptr);
return NULL;
}
======= Here is another thread function, which passes well: =======
void *TaskCode(void *argument)
{
unsigned int a = 0xDEADBEEF;
unsigned int *ptr = &a;
printf("I am a thread... a = %u *ptr = %u \n", a, *ptr);
return NULL;
}
======= The difference: =======
--- wrong.c 2013-11-12 13:09:04.870404143 +0100
+++ right.c 2013-11-12 13:12:02.108676760 +0100
@@ -12,7 +12,7 @@
unsigned int a = 0xDEADBEEF;
unsigned int *ptr = &a;
- printf("I am a thread... a = %u *ptr = %u ptr = %p \n", a, *ptr, ptr);
+ printf("I am a thread... a = %u *ptr = %u \n", a, *ptr);
return NULL;
}
........ so it seems that when I want to print the pointer's value (the target address), it causes ltrace to crash...
The attached reproducer contains both files - right.c and wrong.c - and this is the diff between them. The reproducer.sh script compiles them both and runs ltrace on them. The ltrace in the second case (wrong.c) falls down with 134 exitcode and some dump.
Version-Release number of selected component (if applicable):
ltrace-0.7.2-5.el7.x86_64
kernel-3.10.0-33.el7.x86_64
How reproducible:
Unpack & run the attached reproducer... or ...
Steps to Reproduce:
1. gcc -o wrong -lpthread wrong.c
2. ltrace -o ltrace.log -f ./wrong
Actual results:
ltrace dies with 134 and dump like this:
*** glibc detected *** ltrace: free(): invalid pointer: 0x0000000000629120 ***
======= Backtrace: =========
/lib64/libc.so.6[0x394ee7cb3e]
ltrace[0x409b28]
ltrace[0x40a3ab]
ltrace[0x40c041]
ltrace[0x40b3ee]
ltrace[0x416db8]
ltrace[0x417a79]
ltrace[0x4034ec]
ltrace[0x402f2e]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x394ee21a05]
ltrace[0x402f61]
======= Memory map: ========
00400000-00426000 r-xp 00000000 08:01 668887 /usr/bin/ltrace
00625000-00626000 r--p 00025000 08:01 668887 /usr/bin/ltrace
00626000-00628000 rw-p 00026000 08:01 668887 /usr/bin/ltrace
00628000-0062a000 rw-p 00000000 00:00 0
00827000-00829000 rw-p 00027000 08:01 668887 /usr/bin/ltrace
00e42000-00ea5000 rw-p 00000000 00:00 0 [heap]
...
Expected results:
The ltrace don't crash and traces as expected.
Additional info:
* When traced under strace, everything goes well.
* The bug occurs also on Fedora 18 with ltrace-0.7.2-1.fc18.x86_64
The problem probably is somewhere in the printf-tracing.
This code is enough to cause the ltrace's fail, no threads are necessary:
-----------
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned int a = 0xDEADBEEF;
unsigned int *ptr = &a;
printf("a = %u *ptr = %u ptr = %p \n", a, *ptr, ptr);
return 0;
}
-----------
gcc wrong.c
ltrace ./a.out
....
This request was resolved in Red Hat Enterprise Linux 7.0.
Contact your manager or support representative in case you have further questions about the request.
Comment 9Fedora Update System
2015-11-09 13:08:49 UTC
Description of problem: When 'ltrace -f' is run on a binary which uses pointers in the thread function, the ltrace dies with 134 errorcode. ======= Here is the nesty thread function: ======== void *TaskCode(void *argument) { unsigned int a = 0xDEADBEEF; unsigned int *ptr = &a; printf("I am a thread... a = %u *ptr = %u ptr = %p \n", a, *ptr, ptr); return NULL; } ======= Here is another thread function, which passes well: ======= void *TaskCode(void *argument) { unsigned int a = 0xDEADBEEF; unsigned int *ptr = &a; printf("I am a thread... a = %u *ptr = %u \n", a, *ptr); return NULL; } ======= The difference: ======= --- wrong.c 2013-11-12 13:09:04.870404143 +0100 +++ right.c 2013-11-12 13:12:02.108676760 +0100 @@ -12,7 +12,7 @@ unsigned int a = 0xDEADBEEF; unsigned int *ptr = &a; - printf("I am a thread... a = %u *ptr = %u ptr = %p \n", a, *ptr, ptr); + printf("I am a thread... a = %u *ptr = %u \n", a, *ptr); return NULL; } ........ so it seems that when I want to print the pointer's value (the target address), it causes ltrace to crash... The attached reproducer contains both files - right.c and wrong.c - and this is the diff between them. The reproducer.sh script compiles them both and runs ltrace on them. The ltrace in the second case (wrong.c) falls down with 134 exitcode and some dump. Version-Release number of selected component (if applicable): ltrace-0.7.2-5.el7.x86_64 kernel-3.10.0-33.el7.x86_64 How reproducible: Unpack & run the attached reproducer... or ... Steps to Reproduce: 1. gcc -o wrong -lpthread wrong.c 2. ltrace -o ltrace.log -f ./wrong Actual results: ltrace dies with 134 and dump like this: *** glibc detected *** ltrace: free(): invalid pointer: 0x0000000000629120 *** ======= Backtrace: ========= /lib64/libc.so.6[0x394ee7cb3e] ltrace[0x409b28] ltrace[0x40a3ab] ltrace[0x40c041] ltrace[0x40b3ee] ltrace[0x416db8] ltrace[0x417a79] ltrace[0x4034ec] ltrace[0x402f2e] /lib64/libc.so.6(__libc_start_main+0xf5)[0x394ee21a05] ltrace[0x402f61] ======= Memory map: ======== 00400000-00426000 r-xp 00000000 08:01 668887 /usr/bin/ltrace 00625000-00626000 r--p 00025000 08:01 668887 /usr/bin/ltrace 00626000-00628000 rw-p 00026000 08:01 668887 /usr/bin/ltrace 00628000-0062a000 rw-p 00000000 00:00 0 00827000-00829000 rw-p 00027000 08:01 668887 /usr/bin/ltrace 00e42000-00ea5000 rw-p 00000000 00:00 0 [heap] ... Expected results: The ltrace don't crash and traces as expected. Additional info: * When traced under strace, everything goes well. * The bug occurs also on Fedora 18 with ltrace-0.7.2-1.fc18.x86_64