Subject: gdb cannot read exe from another container (attach)
Date: Tue, 17 Sep 2019 13:32:38 +0200
Package: gdb
Version: 8.2.1-2
Severity: normal
Hi,
When attaching to a process which resides in another mount-namespace, warnings
are printed and while debugging symbols are not resolved. Besides that it seems
to work though. The messages are:
(gdb) attach 26303
Attaching to process 26303
warning: "target:/bin/bash": could not open as an executable file: Operation
not permitted.
warning: `target:/bin/bash': can't open to read symbols: Operation not
permitted.
warning: Could not load vsyscall page because no executable was specified
0x00007ff1f2368681 in ?? ()
Steps to reproduce:
In Terminal 1:
$ sudo unshare -m
$ su $YOUR_USER # running as your user should allow gdb attach
$ echo $$
# -> note the PID
In Terminal 2:
$ gdb
attach $PID
Tested with gdb versions 7.12-6 and 8.2.1-2.
On CentOS with gdb 7.6.1 the problem does *not* occur, so I suspect there is a
debian-specific security-policy active, which causes that behaviour.
Thanks
Tycho
-- System Information:
Debian Release: 9.11
APT prefers oldstable-updates
APT policy: (500, 'oldstable-updates'), (500, 'oldstable-debug'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-11-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages gdb depends on:
ii libbabeltrace-ctf1 1.5.1-1
ii libbabeltrace1 1.5.1-1
ii libc6 2.24-11+deb9u4
ii libexpat1 2.2.0-2+deb9u2
ii libipt1 1.5-1
ii liblzma5 5.2.2-1.2+b1
ii libncurses5 6.0+20161126-1+deb9u2
ii libpython3.5 3.5.3-1+deb9u1
ii libreadline7 7.0-3
ii libtinfo5 6.0+20161126-1+deb9u2
ii zlib1g 1:1.2.8.dfsg-5
Versions of packages gdb recommends:
ii libc6-dbg [libc-dbg] 2.24-11+deb9u4
Versions of packages gdb suggests:
pn gdb-doc <none>
pn gdbserver <none>
-- no debconf information