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

implement cwd and mount namespace/chroot tracking #6

Open
anonymouse64 opened this issue Jun 17, 2020 · 1 comment
Open

implement cwd and mount namespace/chroot tracking #6

anonymouse64 opened this issue Jun 17, 2020 · 1 comment
Labels
enhancement New feature or request large

Comments

@anonymouse64
Copy link
Contributor

Currently, if a program issues a syscall like this:

20563 1592353877.755357 symlink("some-link", "/home/user/snap/chromium/1193/.config/chromium/SingletonLock") = 0

then we don't correctly track that the resultant file created is $CWD/some-link, because we only see "some-link" in the syscall. There are a few other syscalls like this that work with the AT_FDCWD special value as well that we are not resolving properly again due to the fact that we don't track current working directory changes.

The code to do this is not hard, we would probably just have to have a regexp that catches the chdir syscall and keep track of it as the loop progress through every syscall, and then also have another specific regexp that matches the set of syscalls that use this pattern as well as any syscall that uses AT_FDCWD with a non-absolute path as another syscall argument, and then do the replacement.

There's a related and similar problem about tracking mount namespace changes and chroots where we want to follow the changes into the mount namespace to see that a strictly confined snap accessing /lib/x86_64-linux-gnu/libc-2.27.so is really accessing the base snap's file i.e. /snap/core18/current/lib/x86_64-linux-gnu/libc-2.27.so

@anonymouse64
Copy link
Contributor Author

A simple way to handle part of this actually for snaps is to enter the snap's mount namespace through i.e. snap run --shell or the /run/snapd/ns/... files so that we can at least see the size/existence of files from the base snap. That still isn't the full picture though

@anonymouse64 anonymouse64 added enhancement New feature or request large labels Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request large
Projects
None yet
Development

No branches or pull requests

1 participant