Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

procfs: make is_subset check cheaper #90

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

cyphar
Copy link
Member

@cyphar cyphar commented Oct 14, 2024

Allocating file descriptors for the is_subset check is completely unnecessary. We can just do a basic faccessat(2) check -- the paths we care about are very basic and we only care if they exist at all and not their contents or what they point to.

In addition, because we check /proc/1 and /proc/stat, using faccessat(2) will avoid us thinking that /proc is a subset if something has overmounted /proc/stat (technically is a subset but that's just a game of whack-a-mole we can't win).

Signed-off-by: Aleksa Sarai [email protected]

Allocating file descriptors for the is_subset check is completely
unnecessary. We can just do a basic faccessat(2) check -- the paths we
care about are very basic and we only care if they exist at all and not
their contents or what they point to.

In addition, because we check /proc/1 and /proc/stat, using faccessat(2)
will avoid us thinking that /proc is a subset if something has
overmounted /proc/stat (technically is a subset but that's just a game
of whack-a-mole we can't win).

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar cyphar force-pushed the proc-cheaper-is_subset branch 2 times, most recently from c8e6aa7 to 13966e0 Compare October 14, 2024 13:44
@cyphar cyphar merged commit 14f579c into openSUSE:main Oct 14, 2024
67 checks passed
@cyphar cyphar deleted the proc-cheaper-is_subset branch October 14, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant