﻿# Inspect ptrace restrictions on an attached profiler

Explain the target relationship, credentials and tracing policy before treating same-user attach failure as a reason to disable protection.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-linux-ptrace-profiler/
Language: en

An attached profiler cannot inspect a model process launched by another supervisor, even when both processes use the same account. Linux ptrace access includes more than a matching username. Credentials, dumpable state, namespaces and a configured security module can affect attachment. Read the actual denied operation before weakening the host's tracing policy.

## Identify attachment versus launch

Record whether the profiler started the worker or attempted to attach later, with both process identities and their relationship. The two paths can have different policy outcomes. A successful profile of a freshly launched toy process does not prove permission to attach to a long-lived service managed elsewhere. Preserve the target instance rather than only the reusable service name.

## Read the core access conditions

The ptrace interface documents checks involving credentials, target dumpability, capabilities and security modules. Same effective username is not the entire rule. A privilege-changing execution can alter the target's dumpable state. Inspect the applicable evidence without reading private model requests merely to demonstrate that attachment would be powerful if it were allowed.

## Account for Yama relationship policy

Where Yama is enabled, ptrace_scope adds documented restrictions and relationship rules. The target can support a declared debugger relationship in applicable modes. Read the actual configured mode and implementation contract rather than assuming every same-user attachment should pass. A policy intended to restrict unrelated processes can explain why supervised attachment differs from profiling a child created by the tool.

## Keep namespaces and other restrictions visible

Capabilities are evaluated in relevant namespace context, and a container can impose further constraints. A host-side privileged observation and an in-container attachment are not equivalent controls. Preserve the exact error and scope. Do not disable several mechanisms together, because the resulting success would not identify which access boundary blocked the intended original workflow.

## Verify an authorized diagnostic relationship

In a disposable equivalent, compare supported profiler-launched and attached cases under the intended policy, with harmless process contents. Acceptance means the allowed relationship and denied case are understood. It does not establish that broad attachment is needed for production, guarantee every profiler uses the same interface or show that fixing a tracing permission issue improves the model's actual latency.

## Primary references

[Linux Process Tracing Access](https://man7.org/linux/man-pages/man2/ptrace.2.html).

[Linux Yama ptrace Policy](https://docs.kernel.org/admin-guide/LSM/Yama.html).

[Process Directory Ownership](https://man7.org/linux/man-pages/man5/proc_pid.5.html).

Related reading: [Inference API telemetry without default prompt capture](/journal/provider-telemetry-content-redaction/); [Operation not permitted in a GPU container: checking seccomp](/journal/container-seccomp-permission-denied/).
