Skip to content

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
ValveSoftware:proton_11.0from
natbro:natbro/qemu-user-32bit-fixes
Closed

quemu-user 32-bit fixes in support of building Proton in linux/amd64 containers on non-Intel hosts#350
natbro wants to merge 2 commits into
ValveSoftware:proton_11.0from
natbro:natbro/qemu-user-32bit-fixes

Conversation

@natbro

@natbro natbro commented Aug 22, 2026

Copy link
Copy Markdown

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.

natbro added 2 commits August 22, 2026 10:52
…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>
@kisak-valve

Copy link
Copy Markdown
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.

@natbro

natbro commented Aug 22, 2026

Copy link
Copy Markdown
Author

will do, somehow thought order-of-operations was reversed. slightly different upstream, so I'll note that and reference that merge request shortly.

@natbro

natbro commented Aug 23, 2026

Copy link
Copy Markdown
Author

FYI - this is in support of ValveSoftware/Proton#10087

@natbro

natbro commented Aug 23, 2026

Copy link
Copy Markdown
Author

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