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

stat,seccomp: fix 32-bit overflow on stat quantities #98

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Snaipe
Copy link
Member

@Snaipe Snaipe commented Nov 12, 2024

On most i686 distributions, glibc implements stat() for programs compiled
without -D_FILE_OFFSET_BITS=64 by calling the corresponding stat64 system
call, and if any of the 64-bit quantities in the statbuf are larger than
2^32-1, the glibc wrapper pretends the file does not exist by returning
ENOENT.

This flag mitigates the issue by pulling the rug under glibc and rewriting
the quantities to stay within bounds. For timestamps, a fixed date within
range is used. For inode numbers, the value is rewritten in a way that
keeps the (device, inode) pair unique.

On most i686 distributions, glibc implements stat() for programs compiled
without -D_FILE_OFFSET_BITS=64 by calling the corresponding stat64 system
call, and if any of the 64-bit quantities in the statbuf are larger than
2^32-1, the glibc wrapper pretends the file does not exist by returning
ENOENT.

This flag mitigates the issue by pulling the rug under glibc and rewriting
the quantities to stay within bounds. For timestamps, a fixed date within
range is used. For inode numbers, the value is rewritten in a way that
keeps the (device, inode) pair unique.
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