Skip to content

Add some /proc handling#3613

Merged
sporksmith merged 1 commit intoshadow:mainfrom
sporksmith:proc-self
Jun 26, 2025
Merged

Add some /proc handling#3613
sporksmith merged 1 commit intoshadow:mainfrom
sporksmith:proc-self

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith commented Jun 25, 2025

Remap /proc/self/* paths to point to the correct native path. Notably this fixes behavior for reading /proc/self/maps, which the rust runtime does, and for reading /proc/self/exe which asan does.

Log a warning when opening proc files that we haven't specifically tested, thought about, or otherwise vetted.

Progress on #3541
Fixes #3536
Progress on #2790

@sporksmith sporksmith self-assigned this Jun 25, 2025
@github-actions github-actions bot added Component: Testing Unit and integration tests and frameworks Component: Main Composing the core Shadow executable labels Jun 25, 2025
@sporksmith sporksmith requested a review from a team June 25, 2025 19:39
@sporksmith
Copy link
Copy Markdown
Contributor Author

I had tried adding a determinism test that checksums the contents of /proc/self/maps, but it doesn't quite pass due to the shared memory regions that the shim loads getting different names and inode numbers on each run. e.g.:

< 7ffff71df000-7ffff79df000 rw-s 00000000 00:1e 126629                     /dev/shm/shadow_shmemfile_701540.832816749-1656503
---
> 7ffff71df000-7ffff79df000 rw-s 00000000 00:1e 126630                     /dev/shm/shadow_shmemfile_701540.931295999-1656567

It might be nice to still write a test that "checksums all of the contents of /proc/maps except for shadow_shmemfile lines" or better yet add a more specialized /proc/maps handler in shadow that filters out these lines altogether, but for now I'd like to just get this 90% solution that I've been sitting on merged :)

Copy link
Copy Markdown
Member

@robgjansen robgjansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks great!

Remap /proc/self/* paths to point to the correct native path. Notably
this fixes behavior for reading `/proc/self/maps`, which the rust
runtime does, and for reading `/proc/self/exe` which asan does.

Log a warning when opening proc files that we haven't specifically
tested, thought about, or otherwise vetted.

Fixes shadow#3541
Fixes shadow#3536
Progress on shadow#2790
@sporksmith sporksmith enabled auto-merge (squash) June 26, 2025 20:59
@sporksmith sporksmith merged commit e1990cb into shadow:main Jun 26, 2025
25 checks passed
sporksmith added a commit to sporksmith/shadow that referenced this pull request Jun 26, 2025
sporksmith added a commit to sporksmith/shadow that referenced this pull request Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable Component: Testing Unit and integration tests and frameworks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn when plugin opens a file in /proc

2 participants