Repository navigation
[AUTOMATED] Reject stated jump destinations whose labels depend on the load address or code segment - #1933
Conversation
…e load address or code segment
080ce68 to
7cab440
Compare
…ment Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
…segmented A real-mode or 16-bit protected-mode destination is an offset in a code segment: CS for a near jump, the loaded segment for a far one. SLEIGH lifts the prefixed near jumps (67/66 67 ff /4) and the far jump (ff /5) without the segment operation, so the producer check accepted them and labelled cases with linear addresses the jump's value cannot equal (for example `case 0x10004:` against `eax` for `jmp eax` at 0x10000). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
… near jumps The placement stage test now expects all three real-mode jumps rejected as segmented; the CLI test adds the far jump at 0x100 and a prefixed `jmp eax`, and keeps the 32-bit `jmp ax` as the width rule's accepted case. cli.md, spec 02 and the stages README describe the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
|
[AUTOMATED] Pushed e7c2c4c on top of your rebased head 7cab440 (no force). It merges main e033b33 (xml.rs count 901, stage baseline) and adds two commits: every computed branch of a 16-bit x86 language is now rejected as segmented. SLEIGH lifts the prefixed near jumps ( printf '\x66\x67\xff\xe0\x66\xb8\x0b\x00\x00\x00\xc3\x66\xb8\x16\x00\x00\x00\xc3' > eax.bin
kuna decompile eax.bin 0x10000 --addr --raw-image --target 'x86:LE:16:Real Mode:default' \
--base 0x10000 --assert 'jumptable 10000 10004 1000b'It printed |
…ions The tree is unchanged: main's tree equals Noelo-Lab#1933's head, which this branch already contains. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
The problem
A
jumptableassertion still labels cases with mapped addresses on images whose code runs elsewhere when the loader is not the ELF, PE or Mach-O one. This DOS executable jumps throughax; DOS picks its segment at load time, and the C compares the 16-bit offset with linear addresses it can never equal.A UEFI TE image with base relocations prints the same kind of cases, and so does any segmented real-mode jump, raw image included. A jump that takes a 16-bit value does too:
jmp far [bx]at 0x10000 printscase 0x10002:against a 16-bit load, and a 32-bitjmp axstated as reaching 0x401003 printscase 0x1003:.The fix
runtime load base is unknown for this image.--assert-strictfails.Tests
tests/stages/kuna-stated-jump-placement.xmlpins the rejection of a real-mode near jump, a far jump above 0xffff and the MZ fixture, and the cases of a far jump whose destinations fit. The CLI tests cover TE images with and without a base-relocation directory, an MZ executable, and real-mode and 32-bit jumps whose output must equal the unhinted run. Both fail on main, which prints the cases. A microMIPS language still accepts a 4-aligned destination.Known limitation
MIPS16e and microMIPS destinations cannot be stated yet.
jrclears the mode bit from its operand, and the directive has no way to say that a destination is compressed code, so each destination is checked against the mode its context already holds. A 2-byte-aligned destination, or its odd mode-bit form, is rejected:A follow-up can accept a destination's ISA mode and set it before flow, which ARM interworking needs as well.
Model:
anthropic/claude-opus-5-5