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

Fallback to direct access instead of through /proc/[pid]/root/ #602

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

happyCoder92
Copy link
Contributor

In some namespace setups the binary might not even be present in the mnt_ns. This is the case if it's launched from an fd in a specially prepared empty mnt_ns via a execveat (sandboxing usecase).

Therefore it makes sense to fallback to the original path.

In some namespace setups the binary might not even be present in the mnt_ns.
This is the case if it's launched from an fd in a specially prepared empty mnt_ns via a execveat (sandboxing usecase).

Therefore it makes sense to fallback to the original path.
@bregma
Copy link
Member

bregma commented Aug 24, 2023

It seems to me this will always revert to the original path since /proc/PID/root is usually a symbolic link so !S_ISREG(st.st_mode) will always be true?

copybara-service bot pushed a commit to google/sandboxed-api that referenced this pull request Aug 24, 2023
It was fixed internally and libunwind/libunwind#602 should make it better for OSS.

PiperOrigin-RevId: 559772982
Change-Id: Ifcbf824d37cb4988dc56db20a8bbaaaf52a2cb81
@happyCoder92
Copy link
Contributor Author

It's stat and not lstat, but yeah /proc/PID/root will likely be a dir and that's checked already above (line 73).
This is about the full path so /proc/PID/root/path/to/my/executable/exec_file, so expecting it to be a file is fine I believe.

@bregma
Copy link
Member

bregma commented Aug 25, 2023

Ah, OK, I was misreading the preceding code. This is fine.

@bregma bregma merged commit 6e6c071 into libunwind:master Aug 25, 2023
12 of 23 checks passed
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.

None yet

2 participants