proot icon indicating copy to clipboard operation
proot copied to clipboard

Debugging binaries within another sysroot on newer kernels

Open oxr463 opened this issue 4 years ago • 0 comments

We used proot and gdb to debug binaries within another sysroot. While it worked with the master branch and with an older kernel it doesn't work with a more recent kernel and/or this patch.

You can reproduce it with this command:

$ proot -R / gdb /bin/true
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /bin/true...(no debugging symbols found)...done.
(gdb) run
Starting program: /bin/true 
warning: linux_check_ptrace_features: failed to kill child

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x00007fffffffcffb in ?? ()
#3  0x00007fffffffd005 in ?? ()
#4  0x00007fffffffd008 in ?? ()
#5  0x0000000000000000 in ?? ()

With an older kernel and the master branch it works fine and when the application throws a segmentation fault we can catch it in gdb.

With a more recent kernel and the master branch we have to use PROOT_NO_SECCOMP=1 but gdb freezes when the application terminates. With a more recent kernel and this PR we get a segmentation fault as documented above.

Originally posted by @walterbrebels in https://github.com/proot-me/proot/pull/130#issuecomment-344664485

oxr463 avatar Jan 08 '20 19:01 oxr463