I want to debug an aarch64 ELF using GDB installed on an arm64v8/alpine docker on my x86_64 16.04 Ubuntu VirtualBox, which itself is installed on my Mac. In particular, to set up the docker I use the instructions here. That is:
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo docker run --rm -it -v /directory_on_ubuntu:/directory_on_alpine arm64v8/alpine /bin/ash
I install GDB on the alpine container and get the PID of the ELF process using the ps aux command in alpine, attach to it using (gdb) attach PID at point which I receive a ptrace: Function not implemented warning. I've read posts on --cap-add=SYS_PTRACE and seccomp tags but shouldn't the privileged tag in the first line take care of the security aspects of the docker? I also looked into the /proc/sys/kernel/yama/ptrace_scope file on both the container and my Ubuntu host and set the value to 0. It's also worth mentioning that I didn't find any /etc/sysctl.d/10-ptrace.conf file on the alpine container while on the Ubuntu host the variable kernel.yama.ptrace_scope=0. But I feel ptrace not being implemented means there is a bigger issue maybe with the way I set up the docker. Any help or workarounds for getting GDB to debug the binary is appreciated.