quemu-user 32-bit fixes in support of building Proton in linux/amd64 containers on non-Intel hosts - #350
Closed
natbro wants to merge 2 commits into
Closed
Conversation
…around. mmap_add_reserved_area() and mmap_remove_reserved_area() trim a single byte when addr + size wraps to 0, leaving an area whose end is 0xffffffff. alloc_virtual_heap() derives its mapping address from that end and passes an unaligned address to anon_mmap_fixed(), tripping the alignment assertions added in d813ffc. Trim a whole page instead so the area bounds stay aligned. Only reached when a reserved area ends exactly at 4GB, which requires mmap_init() to take the reserve_area( user_space_limit, 0 ) branch -- that is, when the initial stack is not near the top of the 32-bit address space. Native Linux places it near the top so the branch is dead there; qemu-user maps the 32-bit stack around 0x40000000, making it reachable and aborting every 32-bit process at startup. This is hit when building or running Proton in a container on an arm64 host, where 32-bit x86 goes through qemu-user. Submitted upstream separately. Signed-off-by: Nat Brown <natbro@gmail.com>
… one. qemu-user synthesizes signal frames without filling in the trap number, leaving TRAP_sig() as -1. segv_handler() falls through to the default case, logs "Got unexpected trap -1" and never services the fault, so page faults during 32-bit module loading surface as unhandled exceptions. Infer the trap from the delivered signal. ERROR_sig() is unset for the same reason, so faults routed to TRAP_x86_PAGEFLT are classified as reads; enough to get through process startup but not a complete emulation of the missing context. Submitted upstream separately. Signed-off-by: Nat Brown <natbro@gmail.com>
Member
|
Hello @natbro, this should be reviewed and merged upstream first. After it's landed, leave a note here with a link to the commit and a Proton dev can ponder a backport. |
Author
|
will do, somehow thought order-of-operations was reversed. slightly different upstream, so I'll note that and reference that merge request shortly. |
Author
|
FYI - this is in support of ValveSoftware/Proton#10087 |
Author
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.
two minor latent issues found when running 32-bit wine in linux/amd64 containers when the host uses qemu-user for 32-bit processes, such as Docker or Podman using Apple Virtualization on Apple Silicon (x86_64 is run via Rosetta 2, i386 is handled by qemu). Individual commits have further documentation.