Bug 1254306 - memstomp provides an incomplete backtrace despite debuginfo packages installed on the system
Summary: memstomp provides an incomplete backtrace despite debuginfo packages installe...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: memstomp
Version: DTS 9.0 RHEL 7
Hardware: Unspecified
OS: Linux
low
low
Target Milestone: ---
: 9.0
Assignee: Jeff Law
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-17 16:33 UTC by Miroslav Franc
Modified: 2019-07-16 15:24 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-16 15:24:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Miroslav Franc 2015-08-17 16:33:56 UTC
The core issue seems to be that memstomp expects debuginfo in /usr/lib64/debug and not /usr/lib/debug.

Not sure whether this is fault of memstomp or binutils or something else.


Version-Release number of selected component (if applicable):
# rpm -q memstomp memstomp-debuginfo glibc glibc-debuginfo
memstomp-0.1.4-11.el7.x86_64
memstomp-0.1.4-11.el7.i686
memstomp-debuginfo-0.1.4-11.el7.x86_64
memstomp-debuginfo-0.1.4-11.el7.i686
glibc-2.17-103.el7.x86_64
glibc-2.17-103.el7.i686
glibc-debuginfo-2.17-103.el7.x86_64
glibc-debuginfo-2.17-103.el7.i686

You can observe the same thing with devtoolset memstomp as well.


Details:

1. There is a file called w.c:
---
#define __NO_STRING_INLINES
#include <string.h>

char d[] = "ABC";

int
main (void)
{
  strcat (d, d);
  return 0;
}
---

2. Let's compile it.
# gcc -rdynamic -g -fno-builtin w.c -o w


3. Let's get a backtrace.
# LD_PRELOAD=libmemstomp.so:libmemstomp-backtrace-symbols.so ./w
memstomp: 0.1.4 successfully initialized for process w (pid 22542).


strcat(dest=0x601037, src=0x601034, bytes=4) overlap for w(22542)
        ??:0    strcpy()
        ??:0    strcpy()
        ??:0    strcat()
        w.c:10  main()
        ??:0    __libc_start_main()
        ??:0    _start()


Obviously glibc and memstomp parts are missing debugging information despite debuginfo packages installed on the system.


4. Closer look: (truncated)

# strace -etrace=open -ELD_PRELOAD=libmemstomp.so:libmemstomp-backtrace-symbols.so ./w

open("/lib64/.debug/libmemstomp.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/debug/usr/lib64/libmemstomp.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/.debug/libc-2.17.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/debug/usr/lib64/libc-2.17.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)

# rpm -ql memstomp-debuginfo | grep libmemstomp.so.debug
/usr/lib/debug/usr/lib64/libmemstomp.so.debug
/usr/lib/debug/usr/lib/libmemstomp.so.debug


5. Let's stick the debuginfos where they are expected.
# ln -s /usr/lib/debug/ /usr/lib64/debug


6. Get a backtrace now.
# LD_PRELOAD=libmemstomp.so:libmemstomp-backtrace-symbols.so ./w
memstomp: 0.1.4 successfully initialized for process w (pid 22544).


strcat(dest=0x601037, src=0x601034, bytes=4) overlap for w(22544)
        memstomp.c:347  strcat()
        w.c:10  main()
        libc-start.c:308        __libc_start_main()
        ??:0    _start()

This looks much more reasonable.


7. Closer look: (truncated)
# strace -etrace=open -ELD_PRELOAD=libmemstomp.so:libmemstomp-backtrace-symbols.so ./w

open("/lib64/.debug/libmemstomp.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/debug/usr/lib64/libmemstomp.so.debug", O_RDONLY) = 4
open("/usr/lib64/debug/usr/lib64/libmemstomp.so.debug", O_RDONLY) = 4
open("/usr/lib64/debug/usr/lib64/../../.dwz/memstomp-0.1.4-11.el7.x86_64", O_RDONLY) = 5
open("/usr/lib64/debug/usr/lib64/../../.dwz/memstomp-0.1.4-11.el7.x86_64", O_RDONLY) = 5

open("/lib64/.debug/libc-2.17.so.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/debug/usr/lib64/libc-2.17.so.debug", O_RDONLY) = 4
open("/usr/lib64/debug/usr/lib64/libc-2.17.so.debug", O_RDONLY) = 4

Comment 7 Jeff Law 2019-07-16 15:24:23 UTC
We're not planning further development on memstomp.


Note You need to log in before you can comment on or make changes to this bug.