relinker: masked_store_lowering flakes under Rosetta with "Masked store stub changed the flags" #12284
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-10-28T07:13:17Z.
What happens
masked_store_loweringsometimes fails in therelinker (macos-latest, clang++, x86_64)job with only:The same test passes on
mainand on other pull requests run at about the same time. Two occurrences on unrelated PRs, both on head commits that don't touch the relinker's masked-store code:fix/relinker-windows-gs-trap-entry-roots33b48ba39fcodex/libc-strmode(#11664)1185982effI listed every failed pull-request run of
build.ymlfrom 2026-10-24 to 2026-10-28 (200 runs) and read the failed macOS relinker jobs. These are the only twomasked_store_loweringfailures. Every other macOS relinker failure in that window is a different test or a stale-head abort.What the data shows
__x86_64__on Linux and macOS. Onmacos-latest, thex86_64job runs under Rosetta 2 (its log shows "Install of Rosetta 2 finished successfully"). The arm64 macOS job skips the execution part, Windows skips it, and the Linux job runs it natively and has not failed.EmitMaskedStore:lea -0x80(%rsp),pushfq,push rax,push rcx;test cl, bit; jzandlock orb $0, off(%rax)on the first and last byte;pop rcx,pop rax,popfq,lea +0x80(%rsp), and the originalVMASKMOV*store.popfq, nothing writes RFLAGS:lea,VMASKMOVand the patchedretleave them alone.masked_store_lowering_testsidle and 1,000 with 14 busy loops pinning the CPU: 3,456,000 stub executions, 0 failures;Analysis (not measured on macOS)
A flags-only difference that comes and goes, with the general registers and memory intact, points at how Rosetta 2 carries RFLAGS across the probe's
SIGSEGVdelivery andsigreturn, or across a retranslation of the code page the test rewrites before each case. It does not point at the stub bytes.Rosetta already treats faults inside these instructions specially: the debt entry records
unexpectedly need to EmulateForward on a synchronous exceptionfor faulting masked stores.Which flag changes, and whether the failing execution took a fault, isn't known. The current message prints neither.
If Rosetta does lose RFLAGS across a fault, that matters beyond this test. Guest code that faults on a write-watched page under
--to-rosettacould resume with different flags.Next step
A test-only PR makes the failure message print the form, width, addressing mode, offset, mask pattern, fault count, and the flags before and after. The next occurrence then says which flag changes and whether a fault was involved. Whether to make the check tolerant under Rosetta can be decided from that data.
AI-assisted: yes (Claude Code). The CI data and the native runs are measured; the Rosetta explanation is analysis, not a measurement.