Repository navigation
LATX, fix: Clear zero absolute LEA destinations - #387
Merged
LaurenIsACoder merged 1 commit intoAug 11, 2026
Merged
LaurenIsACoder merged 1 commit into
LaurenIsACoder merged 1 commit into
Conversation
convert_mem_helper returned the zero operand before writing it to a caller-supplied destination register. As a result, an i386 LEA with no base, index, segment, or displacement left the destination unchanged and corrupted local-dynamic TLS address calculations. Signed-off-by: Hanlu Li <[email protected]>
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.
While looking into #373, I found a concrete i386 LEA translation bug on current master.
convert_mem_helper()returnedzero_ir2_opndimmediately for an address with no base, index, segment, or displacement. That works for callers that consume the returned operand, butconvert_mem_to_specific_gpr()passes a destination register and discards the return value. Forlea edi,[0], EDI was therefore left unchanged. In apt this stale value corrupted the following TLS address calculation and caused a SIGSEGV.This change keeps the existing early return for ordinary address conversion, but lets the specific-register path continue through
adjust_dest()so the zero is actually written. The old assertion is replaced with one that documents this path.Validation:
lea edi,[0]check: exit 1 with the fix hunk reversed, exit 0 with it restoredapt-get --version: exit 0 withLATX_AOT=0 LATX_TU=0apt-get --version: exit 0 with default translation settingsEvery guest run invoked
latx-i386explicitly. The binfmt registration was not used or modified, and the tested apt command did not enter guest fork/exec paths.The reproduced symptom was a deterministic SIGSEGV, not the timeout reported in #373, so this PR is related to that investigation but does not close the issue by itself. The original reproducer still needs to be retested.