KDAB / GammaRay

GammaRay is a tool to poke around in a Qt-application and also to manipulate the application to some extent.
https://www.kdab.com/gammaray
Other
1.61k stars 283 forks source link

segfault while trying to attach to running process #28

Closed nerdoc closed 11 years ago

nerdoc commented 11 years ago

Trying to attach to a running process (New empty GUI template project of QtCreator) using the dialog of GammaRay (GammaRay is running with sudo as root). The process is found, here is the gammaray output when stopping: Remarks:


Error: "/var/tmp/kdecache-christian" is owned by uid 1000 instead of uid 0. QProcess: Destroyed while process is still running. * glibc detected * gdb: double free or corruption (!prev): 0x00000000018ff3a0 ***

warning: not using untrusted file "/home/christian/.gdbinit" ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fbcba91ab96] /lib/x86_64-linux-gnu/libc.so.6(fclose+0x155)[0x7fbcba90a815] gdb[0x6c42e3] gdb[0x5583b0] gdb(do_cleanups+0x1d)[0x55841d] gdb[0x4d0d05] gdb(source_script+0x25)[0x4d0d70] gdb(catch_command_errors+0x50)[0x5c9cd7] gdb[0x5cc6e2] gdb(catch_errors+0x5f)[0x5c9c03] gdb(gdb_main+0x34)[0x5ccc5c] gdb(main+0x4e)[0x44e5aa] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fbcba8bd76d] gdb[0x44e479] ======= Memory map: ======== 00400000-009e3000 r-xp 00000000 08:05 4541 /usr/bin/gdb 00be2000-00be3000 r--p 005e2000 08:05 4541 /usr/bin/gdb 00be3000-00bf7000 rw-p 005e3000 08:05 4541 /usr/bin/gdb 00bf7000-00c17000 rw-p 00000000 00:00 0 01769000-01933000 rw-p 00000000 00:00 0 [heap] 7fbcba03d000-7fbcba483000 r--p 00000000 08:05 341 /usr/lib/locale/locale-archive 7fbcba483000-7fbcba498000 r-xp 00000000 08:05 261754 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fbcba498000-7fbcba697000 ---p 00015000 08:05 261754 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fbcba697000-7fbcba698000 r--p 00014000 08:05 261754 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fbcba698000-7fbcba699000 rw-p 00015000 08:05 261754 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fbcba699000-7fbcba69b000 r-xp 00000000 08:05 272949 /lib/x86_64-linux-gnu/libutil-2.15.so 7fbcba69b000-7fbcba89a000 ---p 00002000 08:05 272949 /lib/x86_64-linux-gnu/libutil-2.15.so 7fbcba89a000-7fbcba89b000 r--p 00001000 08:05 272949 /lib/x86_64-linux-gnu/libutil-2.15.so 7fbcba89b000-7fbcba89c000 rw-p 00002000 08:05 272949 /lib/x86_64-linux-gnu/libutil-2.15.so 7fbcba89c000-7fbcbaa51000 r-xp 00000000 08:05 270328 /lib/x86_64-linux-gnu/libc-2.15.so 7fbcbaa51000-7fbcbac50000 ---p 001b5000 08:05 270328 /lib/x86_64-linux-gnu/libc-2.15.so 7fbcbac50000-7fbcbac54000 r--p 001b4000 08:05 270328 /lib/x86_64-linux-gnu/libc-2.15.so 7fbcbac54000-7fbcbac56000 rw-p 001b8000 08:05 270328 /lib/x86_64-linux-gnu/libc-2.15.so 7fbcbac56000-7fbcbac5b000 rw-p 00000000 00:00 0 7fbcbac5b000-7fbcbac81000 r-xp 00000000 08:05 262372 /lib/x86_64-linux-gnu/libexpat.so.1.6.0 7fbcbac81000-7fbcbae81000 ---p 00026000 08:05 262372 /lib/x86_64-linux-gnu/libexpat.so.1.6.0 7fbcbae81000-7fbcbae83000 r--p 00026000 08:05 262372 /lib/x86_64-linux-gnu/libexpat.so.1.6.0 7fbcbae83000-7fbcbae84000 rw-p 00028000 08:05 262372 /lib/x86_64-linux-gnu/libexpat.so.1.6.0 7fbcbae84000-7fbcbb106000 r-xp 00000000 08:05 4957 /usr/lib/libpython2.7.so.1.0 7fbcbb106000-7fbcbb305000 ---p 00282000 08:05 4957 /usr/lib/libpython2.7.so.1.0 7fbcbb305000-7fbcbb307000 r--p 00281000 08:05 4957 /usr/lib/libpython2.7.so.1.0 7fbcbb307000-7fbcbb370000 rw-p 00283000 08:05 4957 /usr/lib/libpython2.7.so.1.0 7fbcbb370000-7fbcbb382000 rw-p 00000000 00:00 0 7fbcbb382000-7fbcbb39a000 r-xp 00000000 08:05 270330 /lib/x86_64-linux-gnu/libpthread-2.15.so 7fbcbb39a000-7fbcbb599000 ---p 00018000 08:05 270330 /lib/x86_64-linux-gnu/libpthread-2.15.so 7fbcbb599000-7fbcbb59a000 r--p 00017000 08:05 270330 /lib/x86_64-linux-gnu/libpthread-2.15.so 7fbcbb59a000-7fbcbb59b000 rw-p 00018000 08:05 270330 /lib/x86_64-linux-gnu/libpthread-2.15.so 7fbcbb59b000-7fbcbb59f000 rw-p 00000000 00:00 0 7fbcbb59f000-7fbcbb69a000 r-xp 00000000 08:05 270508 /lib/x86_64-linux-gnu/libm-2.15.so 7fbcbb69a000-7fbcbb899000 ---p 000fb000 08:05 270508 /lib/x86_64-linux-gnu/libm-2.15.so 7fbcbb899000-7fbcbb89a000 r--p 000fa000 08:05 270508 /lib/x86_64-linux-gnu/libm-2.15.so 7fbcbb89a000-7fbcbb89b000 rw-p 000fb000 08:05 270508 /lib/x86_64-linux-gnu/libm-2.15.so 7fbcbb89b000-7fbcbb8b1000 r-xp 00000000 08:05 266006 /lib/x86_64-linux-gnu/libz.so.1.2.7 7fbcbb8b1000-7fbcbbab0000 ---p 00016000 08:05 266006 /lib/x86_64-linux-gnu/libz.so.1.2.7 7fbcbbab0000-7fbcbbab1000 r--p 00015000 08:05 266006 /lib/x86_64-linux-gnu/libz.so.1.2.7 7fbcbbab1000-7fbcbbab2000 rw-p 00016000 08:05 266006 /lib/x86_64-linux-gnu/libz.so.1.2.7 7fbcbbab2000-7fbcbbad6000 r-xp 00000000 08:05 266426 /lib/x86_64-linux-gnu/libtinfo.so.5.9 7fbcbbad6000-7fbcbbcd5000 ---p 00024000 08:05 266426 /lib/x86_64-linux-gnu/libtinfo.so.5.9 7fbcbbcd5000-7fbcbbcd9000 r--p 00023000 08:05 266426 /lib/x86_64-linux-gnu/libtinfo.so.5.9 7fbcbbcd9000-7fbcbbcda000 rw-p 00027000 08:05 266426 /lib/x86_64-linux-gnu/libtinfo.so.5.9 7fbcbbcda000-7fbcbbcfa000 r-xp 00000000 08:05 261689 /lib/x86_64-linux-gnu/libncurses.so.5.9 7fbcbbcfa000-7fbcbbef9000 ---p 00020000 08:05 261689 /lib/x86_64-linux-gnu/libncurses.so.5.9 7fbcbbef9000-7fbcbbefa000 r--p 0001f000 08:05 261689 /lib/x86_64-linux-gnu/libncurses.so.5.9 7fbcbbefa000-7fbcbbefb000 rw-p 00020000 08:05 261689 /lib/x86_64-linux-gnu/libncurses.so.5.9 7fbcbbefb000-7fbcbbefd000 r-xp 00000000 08:05 262299 /lib/x86_64-linux-gnu/libdl-2.15.so 7fbcbbefd000-7fbcbc0fd000 ---p 00002000 08:05 262299 /lib/x86_64-linux-gnu/libdl-2.15.so 7fbcbc0fd000-7fbcbc0fe000 r--p 00002000 08:05 262299 /lib/x86_64-linux-gnu/libdl-2.15.so 7fbcbc0fe000-7fbcbc0ff000 rw-p 00003000 08:05 262299 /lib/x86_64-linux-gnu/libdl-2.15.so 7fbcbc0ff000-7fbcbc138000 r-xp 00000000 08:05 268396 /lib/x86_64-linux-gnu/libreadline.so.6.2 7fbcbc138000-7fbcbc338000 ---p 00039000 08:05 268396 /lib/x86_64-linux-gnu/libreadline.so.6.2 7fbcbc338000-7fbcbc33a000 r--p 00039000 08:05 268396 /lib/x86_64-linux-gnu/libreadline.so.6.2 7fbcbc33a000-7fbcbc340000 rw-p 0003b000 08:05 268396 /lib/x86_64-linux-gnu/libreadline.so.6.2 7fbcbc340000-7fbcbc341000 rw-p 00000000 00:00 0 7fbcbc341000-7fbcbc363000 r-xp 00000000 08:05 272947 /lib/x86_64-linux-gnu/ld-2.15.so 7fbcbc38e000-7fbcbc413000 rw-p 00000000 00:00 0 7fbcbc413000-7fbcbc438000 r--p 00000000 08:05 420747 /usr/share/locale-langpack/de/LC_MESSAGES/libc.mo 7fbcbc438000-7fbcbc4aa000 rw-p 00000000 00:00 0 7fbcbc4ab000-7fbcbc534000 rw-p 00000000 00:00 0 7fbcbc54e000-7fbcbc555000 r--s 00000000 08:05 273800 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache 7fbcbc555000-7fbcbc561000 r--p 00000000 08:05 395637 /usr/share/locale-langpack/de/LC_MESSAGES/gdb.mo 7fbcbc561000-7fbcbc563000 rw-p 00000000 00:00 0 7fbcbc563000-7fbcbc564000 r--p 00022000 08:05 272947 /lib/x86_64-linux-gnu/ld-2.15.so 7fbcbc564000-7fbcbc566000 rw-p 00023000 08:05 272947 /lib/x86_64-linux-gnu/ld-2.15.so 7fffc6265000-7fffc6286000 rw-p 00000000 00:00 0 [stack] 7fffc636a000-7fffc636b000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Unable to attach injector gdb Exit code: 0 Error: Process crashed

krf commented 11 years ago

You don't need to run GammaRay as root, it should be fine to attach to a user-space process via the gdb method.

If at all, within KDE, you need to run 'kdesudo gammaray'. sudo won't work for GUI applications.

If you experience issues with attaching to other processes on your system please try to disable this first: https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection

nerdoc commented 11 years ago

Oh. What a coincidence, this is EXACTLY what the ouput of gammaray is trying to tell me. Another unnecessary bug of a guy who can't read the error message twice ;-) Works perfectly after enabling ptrace, "bug" closed.

krf commented 11 years ago

No problem.

I've edited the 'Known issues' list: https://github.com/KDAB/GammaRay/wiki/Known-Issues