This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Analyzing process and core dump files in changed root environments


Hello,

I have a question regarding analyzing processes running in a change root 
environment or in an own mount namespace with re-mounted /.
I want to debug a process running in a non-system root using elfutils or gdb
from system root, and vice versa.
More precisely, I want to create a container shipping ABRT + GDB + elfutils 
and the container should allow users to analyze core dump files on Fedora 
Atomic. I need to run eu-stack on a core dump file generated by a program 
from system root and I need to run it from a container (non-system root).

For example, if I run the following command on Fedora Atomic 25, it crashes 
in the system namespace and ABRT saves its core file to /var/spool/abrt/
ccpp* in ABRT's namespace. If I enter the ABRT container and run eu-stack on
the core dump file, I get an error because the container misses some 
libraries:

$ ostree admin instutil grub2-generate

$ eu-stack --core coredump -e binary                                        
           
PID 1693 - core
TID 1693:
#0  0x00007fbd9c7c892f raise
#1  0x00007fbd9c7ca52a abort
#2  0x00007fbd9d2b0cc5 g_assertion_message
#3  0x00007fbd9d2b0d5a g_assertion_message_expr
#4  0x00007fbd9e713e7e
eu-stack: dwfl_thread_getframes tid 1693 at 0x7fbd9e713e7d in /usr/lib64/
libostree-1.so.1.0.0: Callback returned failure

You may ask what is the binary argument. It's a copy of the crashed program.
It can be replaced with the `/host/bin/ostree` path (I bind mount the hots' 
/ to the container's /host).

GDB allows me to configure 'sysroot', so it knows where to look for 
libraries.  Thus if I run GDB on the same core dump file, I get the 
following ouptut:
$ gdb --batch --ex 'set sysroot /host' --ex 'file binary' --ex 'core 
coredump' --ex 'bt'
Core was generated by `ostree admin instutil grub2-generate'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007fbd9c7c892f in raise () from /host/lib64/libc.so.6
#0  0x00007fbd9c7c892f in raise () from /host/lib64/libc.so.6
#1  0x00007fbd9c7ca52a in abort () from /host/lib64/libc.so.6
#2  0x00007fbd9d2b0cc5 in g_assertion_message () from /host/lib64/libglib-
2.0.so.0
#3  0x00007fbd9d2b0d5a in g_assertion_message_expr () from /host/lib64/
libglib-2.0.so.0
#4  0x00007fbd9e713e7e in _ostree_bootloader_grub2_generate_config () from /
host/lib64/libostree-1.so.1
#5  0x000055b04f4300c1 in ot_admin_instutil_builtin_grub2_generate ()
#6  0x000055b04f42da53 in ot_admin_builtin_instutil ()
#7  0x000055b04f41fd93 in ostree_builtin_admin ()
#8  0x000055b04f4294d7 in ostree_run ()
#9  0x000055b04f41fae0 in main ()

Do elfutils support such an option too?



Kind regards,
Jakub Filak

Hello,

I have a question regarding analyzing processes running in a change root environment or in an own mount namespace with re-mounted /.
I want to debug a process running in a non-system root using elfutils or gdb from system root, and vice versa.
More precisely, I want to create a container shipping ABRT + GDB + elfutils and the container should allow users to analyze core dump files on Fedora Atomic. I need to run eu-stack on a core dump file generated by a program from system root and I need to run it from a container (non-system root).

For example, if I run the following command on Fedora Atomic 25, it crashes in the system namespace and ABRT saves its core file to /var/spool/abrt/ccpp* in ABRT's namespace. If I enter the ABRT container and run eu-stack on the core dump file, I get an error because the container misses some libraries:

$ ostree admin instutil grub2-generate

$ eu-stack --core coredump -e binary                                                  
PID 1693 - core
TID 1693:
#0  0x00007fbd9c7c892f raise
#1  0x00007fbd9c7ca52a abort
#2  0x00007fbd9d2b0cc5 g_assertion_message
#3  0x00007fbd9d2b0d5a g_assertion_message_expr
#4  0x00007fbd9e713e7e
eu-stack: dwfl_thread_getframes tid 1693 at 0x7fbd9e713e7d in /usr/lib64/libostree-1.so.1.0.0: Callback returned failure

You may ask what is the binary argument. It's a copy of the crashed program. It can be replaced with the `/host/bin/ostree` path (I bind mount the hots' / to the container's /host).

GDB allows me to configure 'sysroot', so it knows where to look for libraries.  Thus if I run GDB on the same core dump file, I get the following ouptut:
$ gdb --batch --ex 'set sysroot /host' --ex 'file binary' --ex 'core coredump' --ex 'bt'
Core was generated by `ostree admin instutil grub2-generate'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007fbd9c7c892f in raise () from /host/lib64/libc.so.6
#0  0x00007fbd9c7c892f in raise () from /host/lib64/libc.so.6
#1  0x00007fbd9c7ca52a in abort () from /host/lib64/libc.so.6
#2  0x00007fbd9d2b0cc5 in g_assertion_message () from /host/lib64/libglib-2.0.so.0
#3  0x00007fbd9d2b0d5a in g_assertion_message_expr () from /host/lib64/libglib-2.0.so.0
#4  0x00007fbd9e713e7e in _ostree_bootloader_grub2_generate_config () from /host/lib64/libostree-1.so.1
#5  0x000055b04f4300c1 in ot_admin_instutil_builtin_grub2_generate ()
#6  0x000055b04f42da53 in ot_admin_builtin_instutil ()
#7  0x000055b04f41fd93 in ostree_builtin_admin ()
#8  0x000055b04f4294d7 in ostree_run ()
#9  0x000055b04f41fae0 in main ()

Do elfutils support such an option too?



Kind regards,
Jakub Filak


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]