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

Resolve /proc/thread-self/* in syscall interception code. #101

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

ctalledo
Copy link
Member

@ctalledo ctalledo commented Dec 5, 2024

When intercepting system calls that use filepaths as arguments, those paths may be regular paths or may be paths under /proc (e.g., "/proc/self/fd/", "/proc/self/task//fd/", or "/proc/thread-self/fd/"). Sysbox was dealing properly with the first two but not with the last one (i.e., "/proc/thread-self/*").

This went unnoticed until a recent change in the OCI runc (commit 8e8b136c4923ac33567c4cb775c6c8a17749fd02) where it's now using "/proc/thread-self/" in mount system calls it issues. When that new OCI runc ran inside a Sysbox container, it failed with an error such as:

"error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/8, flags=0xe: no such file or directory: unknown."

See nestybox/sysbox#879 for further info.

This commit fixes this by updating Sysbox to deal properly with syscalls that have "/proc/thread-self/*" in their arguments.

When intercepting system calls that use filepaths as arguments, those paths may
be regular paths or may be paths under /proc (e.g., "/proc/self/fd/<num>",
"/proc/self/task/<tid>/fd/<num>", or "/proc/thread-self/fd/<num>"). Sysbox was
dealing properly with the first two but not with the last one (i.e.,
"/proc/thread-self/*").

This went unnoticed until a recent change in the OCI runc (commit
8e8b136c4923ac33567c4cb775c6c8a17749fd02) where it's now using
"/proc/thread-self/<path>" in mount system calls it issues. When that new OCI
runc ran inside a Sysbox container, it failed with an error such as:

"error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/8, flags=0xe: no such file or directory: unknown."

See nestybox/sysbox#879 for further info.

This commit fixes this by updating Sysbox to deal properly with syscalls that
have "/proc/thread-self/*" in their arguments.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
Copy link
Member

@rodnymolina rodnymolina left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants