ptrace: 좀비 프로세스에 연결할 때 작업이 허용되지 않습니다.

ptrace: 좀비 프로세스에 연결할 때 작업이 허용되지 않습니다.

gdb패키지를 다시 빌드할 때 컴파일러 인스턴스가 좀비 상태가 되지만 연결을 허용하지 않는 재현 가능한 상황이 있습니다 .

serenity ~ # ps ax | grep defunct
11351 pts/1    Z+     0:00 [x86_64-pc-linux] <defunct>
21838 pts/5    S+     0:00 grep --colour=auto defunct
serenity ~ # gdb -p 11351
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
[snip]
Attaching to process 11351
warning: process 11351 is a zombie - the process has already terminated
ptrace: Operation not permitted.
(gdb) 

이 질문문제가 에 있거나 proc.sys.kernel.yama.ptrace_scope루트가 아닐 수도 있지만 sysctl이 내 시스템에 없다는 것을 암시합니다.~이다루트로 실행 중:

serenity ~ # sysctl -a | grep ptrace
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.enp4s0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
serenity ~ # whoami
root
serenity ~ # 

참고로 내 커널 버전은 4.9.16-gentoo.

답변1

질문 출력에 명시된 대로 좀비 프로세스는 실행이 완료된 프로세스이므로 gdb를 사용하여 연결할 수 없습니다. 이제는 해당 프로세스나 리소스가 없는 커널 프로세스 테이블의 항목뿐입니다. 따라서 gdb에 연결할 것이 없습니다.

좀비로 표시된 이 프로세스 테이블 항목이 존재하는 유일한 이유는 종료 상태를 읽기 위한 것입니다.

관련 정보