Repository navigation
[AUTOMATED] fix(analysis): opt-in flowmode keeps a blx target's Thumb mode off A32 functions that flow proves - #795
Merged
Merged
Conversation
mahaloz
force-pushed
the
fix/arm-blx-context
branch
from
October 1, 2026 20:47
16e85f3 to
8ad6fe7
Compare
mahaloz
force-pushed
the
fix/arm-blx-context
branch
5 times, most recently
from
October 2, 2026 05:34
ede94cd to
71f9b39
Compare
mahaloz
force-pushed
the
fix/arm-blx-context
branch
3 times, most recently
from
October 2, 2026 21:09
2b8ca5e to
04a97f2
Compare
mahaloz
force-pushed
the
fix/arm-blx-context
branch
2 times, most recently
from
October 2, 2026 22:44
c3026a6 to
8a0cf43
Compare
…ctions after it Squash of the earlier rounds of this branch, rebased onto main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
…eft in the other mode Main's Listing walk now runs unchanged. Afterwards kuna decodes again, without writing the mode, the code an even e_entry or even function symbol proves the mode of, following branches, fall-through, bl/blx call targets, and the instruction after a call only once the callee is proven to return. Proven instructions whose mode the database disagrees with are painted at the commit; conflicting proofs paint nothing. Only images with no load-time TMode paint take the pass. The even-function-symbol paints and the evidence walk are gone. New option flowmode (default on). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
… counts Two-pass stage test (option off shows halt_missing). CLI tests for a call proven to return, a call that never returns, conflicting proofs, and three stripped armel shapes where a noreturn call or an unsized A32 export sits before a function of the other mode. The veneer fixture goes with the walk it tested. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
…y default A callee that returns does not show that a particular call to it returns: after `report_bad(x); __builtin_unreachable();`, or a call through a noreturn alias of a function that can return, the compiler emits nothing, and the proof then ran on into the next function in the caller's mode. A Thumb function placed there, which the walk decodes correctly, was painted A32. flowmode now takes on|aftercall|off. The default no longer follows the fall-through of an unconditional call; aftercall keeps the previous rule (follow it once the callee is proven to return) for images where that is known to hold, such as GH-780's own layout. Only functions whose every reachable instruction is proven are painted, and the proof decodes mask every context word, so IT-block and LRset commits no longer reach the database either. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
…and is off by default An A32 export that ends in `svc #0` or `bkpt` and then `__builtin_unreachable()` is followed directly by the next function. The proof treated the exception's fall-through as executed, carried A32 into a static Thumb function placed there, and painted it A32. The instruction after any user-defined p-code operation (CALLOTHER) is now never proven, and the function that runs one is not complete, so it is not painted. The proof still trusts the fall-through of an ordinary instruction and the target of a branch, which a compiler can also leave unreachable (clang -O0 ends a noreturn function that stores and then reaches __builtin_unreachable() with the store). The option is therefore off by default; on and aftercall stay available. New fixture arm_exception_end_le32 (svc and bkpt shapes) with a CLI test; the other interworking tests now run under on and aftercall explicitly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
Both #826 and this branch moved the settable counts from 250 to 251, which merged as one bump. Re-derived on a fresh build: 252 settables. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
mahaloz
force-pushed
the
fix/arm-blx-context
branch
from
October 3, 2026 00:16
8a0cf43 to
3357db7
Compare
mahaloz
added a commit
to phix33/kuna
that referenced
this pull request
Oct 3, 2026
Brings in Noelo-Lab#795 (flowmode) and Noelo-Lab#864. Counts re-derived on a fresh build: 253 settables, tiers 81/105/67, 252 catalog rows, corpus 389; the stages baseline is main's plus the three STACK STORE keys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
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.
Problem
In a stripped ARM image, an A32 function placed after a Thumb helper that some caller reaches with
blxdecodes as Thumb, even when it is reached withblfrom A32 code. This image ispush {lr}; bl 0x2000080; blx 0x2000040; pop {pc}, a Thumb helper at0x2000040and an A32add r0,r0,#1; bx lrat0x2000080, with no symbols:The
blxwrites Thumb into the context database from its target up to the next explicit mode change, which in a stripped image is the end of memory. With this branch,--option flowmode onprintsreturn a0 + 1;.Fix
flowmode:off(default),on,aftercall. The Listing walk is unchanged. Withon, kuna then decodes again the code whose mode the image proves, with every context write masked: from an evene_entryor even function symbol (A32), across branches and the fall-through of ordinary instructions, intobltargets in the caller's mode andblxtargets in the other.svcorbkpt(the exception need not come back). A function is painted only when every instruction it can run is proven, and two proofs that disagree on an address paint nothing. The function inventory is untouched.TMode(no mapping symbol, no Thumb function symbol, no Cortex-M vector table), the build attributes allow A32, and no--isais given.aftercallalso continues after a call whose callee is proven to return. That fixes the issue's own layout (blxfirst, thenbl), but paints the wrong mode after a call that never returns at its site.__builtin_unreachable()after a store or a conditional branch (clang -O0 does this fornoreturnfunctions), the proof runs into the next function and paints a static Thumb function there in A32. Not fixed either way: the same leak from a Thumb function symbol ([AUTOMATED] ARM: a Thumb function symbol's mode reaches the A32 function after it when the image has no mapping symbols #842).Tests
tests/stages/kuna-flowmode.xml: the default printshalt_missing,onfixes the image above, and the issue's layout needsaftercall.kuna-cli/tests/arm_interwork_cli.rsruns the interworking images underonandaftercall. New fixturearm_exception_end_le32: A32 exports end insvc #0orbkpt #1and__builtin_unreachable(), each followed by a static Thumb function, which keeps its decode under every value.decompile-allwith the default is byte-identical to main on 14 ARM ELFs, including those whereonpaints. On the 10 in-scope images where the pass has something to correct,onchanges 2 functions andaftercall6, all A32 code main prints as Thumb garbage.kuna functions, interleaved min of 11 on 5 images: -0.5% to +2.5%.Part of #780
🤖 Generated with Claude Code
https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt