Skip to content

Instantly share code, notes, and snippets.

@pich4ya
Last active October 7, 2023 18:29
Show Gist options
  • Save pich4ya/6e3b1cac6218ff37e5c17b02a39e80d2 to your computer and use it in GitHub Desktop.
Save pich4ya/6e3b1cac6218ff37e5c17b02a39e80d2 to your computer and use it in GitHub Desktop.
gdbserver: linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: Operation not permitted
Problem:
จะเอา IDA Pro มา remote debug binary ใน linux container ขึ้นว่า
root@c8a5bde5162d: ~# gdbserver 0.0.0.0:4444 ./main
gdbserver: linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: Operation not permitted
gdbserver: linux_ptrace_test_ret_to_nx: status 256 is not WIFSTOPPED!
Solution:
$ docker ps
$ docker commit <container-id> linux4gdb
$ docker run -it \
> --name linux4gdb1 \
> --privileged \
> --security-opt=apparmor:unconfined \
> -v ~/path/to/share/:/path/to/share/ \
> -p 4445:4445 \
> linux4gdb
$ gdbserver 0.0.0.0:4445 ./main
Process ./main created; pid = 26
Listening on port 4445
Remote debugging from host 172.17.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment