Skip to content

Can't ptrace child started with subprocess.Popen from other child #41

@cmlsharp

Description

@cmlsharp

I apologize if this is an ignorant question. I have a parent process which spawns two children and I need one of the children (created via multiprocessing) to be able to ptrace the other (started via subprocess.Popen) but I am recieving the permission error: ptrace.error.PtraceError: ptrace(cmd=16, pid=15151, 0, 0) error #1: Operation not permitted

Here is sample code that demonstrates what I am trying to do and the error I am encountering:

import multiprocessing
import subprocess
import time

import ptrace.debugger


def ptrace_test(pid):
    debugger = ptrace.debugger.PtraceDebugger()
    process = debugger.addProcess(pid, False)
    # Other stuff


child = subprocess.Popen("/usr/bin/ls")
proc = multiprocessing.Process(target=ptrace_test, args=(child.pid,))
proc.start()
proc.join()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions