Skip to content

Process.Linux: handle when proc mount mismatches with pid namespace #99887

Closed
@tmds

Description

@tmds

In scenarios with (nested) rootless containers, due to limited permissions, a container may have a new pid namespace but still have a parent's mount for /proc.

This causes pids under /proc to mismatch with those seen by the .NET process.

This issue is for making .NET work better in this specific scenario.

.NET can detect the scenario by reading the /proc/self symlink.
In the normal case (where /proc and the pid namespace match), the target path of the link is equal to the process pid.
When /proc is mounted for a parent, the target path will be the pid for the process in the parent pid namespace.

In both cases, .NET can read information about the current process by using /proc/self instead of /proc/<pid>.

In the second case, .NET shouldn't retrieve information about other processes from /proc/<pid> because it can't map between the /proc pid and the process pid namespace.

cc @omajid

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions