Conversation
On x86_64 guests, readlink("/proc/self/exe") and
readlink("/proc/self/fd/N") (with N from opening /proc/self/exe) returned
the Rosetta translator path (ROSETTA_PATH) instead of the running guest
binary. GNU coreutils ships a multi-call binary whose applets
self-identify by reading /proc/self/exe, opening it, then readlink-ing
/proc/self/fd/N and matching the basename. Getting "rosetta" back made
every applet abort with "unknown program 'rosetta'", which broke
Debian/Ubuntu maintainer scripts under apt upgrade and dpkg -i.
Factor the /proc/self/exe resolution (ELF-path snapshot plus
sysroot-prefix strip) into proc_readlink_self_exe. Drop the Rosetta
early-return from the direct /proc/self/exe branch, and in the
/proc/self/fd/N branch substitute the guest binary when the host fd
resolves to ROSETTA_PATH.
proc_intercept_open("/proc/self/exe") still hands back an fd to
ROSETTA_PATH so the VZ ioctl gate (rosetta_ioctl_target_fd) keeps
recognising Rosetta's own self-identification; only the guest-visible
readlink string changed.
Close #107
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On x86_64 guests, readlink("/proc/self/exe") and
readlink("/proc/self/fd/N") (with N from opening /proc/self/exe) returned the Rosetta translator path (ROSETTA_PATH) instead of the running guest binary. GNU coreutils ships a multi-call binary whose applets self-identify by reading /proc/self/exe, opening it, then readlink-ing /proc/self/fd/N and matching the basename. Getting "rosetta" back made every applet abort with "unknown program 'rosetta'", which broke Debian/Ubuntu maintainer scripts under apt upgrade and dpkg -i.
Factor the /proc/self/exe resolution (ELF-path snapshot plus sysroot-prefix strip) into proc_readlink_self_exe. Drop the Rosetta early-return from the direct /proc/self/exe branch, and in the /proc/self/fd/N branch substitute the guest binary when the host fd resolves to ROSETTA_PATH.
proc_intercept_open("/proc/self/exe") still hands back an fd to ROSETTA_PATH so the VZ ioctl gate (rosetta_ioctl_target_fd) keeps recognising Rosetta's own self-identification; only the guest-visible readlink string changed.
Close #107
Summary by cubic
Fixes wrong /proc/self/exe reporting under Rosetta.
readlink("/proc/self/exe")andreadlink("/proc/self/fd/N")now return the guest binary path (sysroot-stripped) so multi-call binaries no longer abort.Bug Fixes
readlink("/proc/self/exe")andreadlink("/proc/self/fd/N")on x86_64 under Rosetta, with sysroot prefix stripped.open("/proc/self/exe")returning a host fd toROSETTA_PATHso the VZ ioctl gate still recognizes Rosetta./proc/self/exeresolves to the guest (basenamebusybox), not Rosetta.Refactors
proc_readlink_self_exe()to resolve the ELF path and strip the sysroot; reuse in both readlink paths./proc/self/exeand substitute the guest path when an fd resolves toROSETTA_PATH.Written for commit ebd6d26. Summary will update on new commits.