blktrace aborts in tb_combine with "realloc(): invalid pointer" when using "-o-" argument

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 6.4
  • blktrace-1.0.1-6.el6.x86_64

Issue

When running blktrace it fails.

#  blktrace -d /dev/sdb -d /dev/dm-3 -o- > /tmp/opt.blktrace
*** glibc detected *** blktrace: realloc(): invalid pointer: 0x00007f9844304c28 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3c1b475366]
/lib64/libc.so.6(realloc+0x2e2)[0x3c1b47b122]
blktrace[0x40326d]
blktrace[0x40241b]
blktrace[0x402fe5]
blktrace[0x404b27]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x3c1b41ecdd]
blktrace[0x401fb9]

Resolution

  • This issue is being tracked in Red Hat Bugzilla 1168101 (bug not publicly accessible, please
    contact your Red Hat Support representative if more information is required).
  • The workaround for the moment is not to use the "-o-" option as this does not happen when the output is not piped.

Diagnostic Steps

  • Gather a core file and check for a stack similar to the following.
Core was generated by `blktrace -d /dev/sdb -d /dev/dm-3 -o-'.
Program terminated with signal 6, Aborted.
#0  0x0000003c1b4328a5 in raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install libgcc-4.4.7-3.el6.x86_64
(gdb) bt
#0  0x0000003c1b4328a5 in raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x0000003c1b434085 in abort () at abort.c:92
#2  0x0000003c1b46fa37 in __libc_message (do_abort=2, 
    fmt=0x3c1b556d20 "*** glibc detected *** %s: %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:198
#3  0x0000003c1b475366 in malloc_printerr (action=3, 
    str=0x3c1b554eb2 "realloc(): invalid pointer", ptr=<value optimized out>)
    at malloc.c:6311
#4  0x0000003c1b47b122 in __libc_realloc (oldmem=0x7f9844304c28, bytes=524385)
    at malloc.c:3783
#5  0x000000000040326d in tb_combine (hd=0x60a210, list=0x7fff44413130)
    at blktrace.c:1324
#6  handle_list_file (hd=0x60a210, list=0x7fff44413130) at blktrace.c:1355
#7  0x000000000040241b in __process_trace_bufs () at blktrace.c:1421
#8  0x0000000000402fe5 in process_trace_bufs () at blktrace.c:1432
#9  wait_tracers () at blktrace.c:1918
#10 0x0000000000404b27 in run_tracers (argc=<value optimized out>, 
    argv=<value optimized out>) at blktrace.c:2618
#11 main (argc=<value optimized out>, argv=<value optimized out>)
    at blktrace.c:2670
(gdb) f 5
#5  0x000000000040326d in tb_combine (hd=0x60a210, list=0x7fff44413130)
    at blktrace.c:1324
1324                    prev = realloc(prev->buf, sizeof(*prev) + tot_len);

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.