Skip to content

Make the blue chat message fix work on 0.35.x - #50

Merged
MisterGatto merged 1 commit into
skyprotocol:osp-masterfrom
HugeFrog24:feature/chat-flag-decoder
Oct 17, 2026
Merged

MisterGatto merged 1 commit into
skyprotocol:osp-masterfrom
HugeFrog24:feature/chat-flag-decoder

Conversation

@HugeFrog24

Copy link
Copy Markdown
Contributor

The old fix hooked a fixed address that is only right on 0.34.5. On 0.35.0 and later that address lands mid-function, and the hook was still being installed there.

The fix now finds its own patch site in libBootloader, so it needs no per-build address. If it doesn't find exactly one match, it patches nothing.

  • Patched: 0.33.5 (Huawei), 0.33.7 through 0.35.1
  • Skipped: 0.33.0, 0.33.2 (different flag layout)
  • Host tests included.

The chat fix hooked libBootloader + 0x13f23b8, the chat-record builder on
Sky 0.34.5 only. From 0.35.0 the builder moved to 0x1466d60 and that
offset lands mid-function, where the hook was still installed.

The builder assembles the record's flag byte (+0x14) bit by bit and never
writes bits 5-7, and its callers pass an uninitialised stack record, so
those bits carry stack garbage. ChatFlagFix finds the builder's mask
`and wA, wA, #0xffffffe3` by data flow (the "chat" call, the flag byte
read-modify-writes) and rewrites it to `and wA, wA, #0x3`, which gives
the same bits 0-4 and clears 5-7, as the hook did. Registers and the
flag offset are decoded, not pinned; anything but exactly one site, or
an instruction that is no longer the expected one, is left unpatched.

Found on 0.33.5 (Huawei) and 0.33.7 through 0.35.1; refused on 0.33.0
and 0.33.2, whose flag layout differs.

Host tests: cmake -S app/src/test/cpp -B <dir> && cmake --build <dir>
&& ctest --test-dir <dir>. Set CHAT_FLAG_FIX_IMAGES to a ;-separated
list of libBootloader.so paths to also scan real images.
@MisterGatto
MisterGatto merged commit 506dda1 into skyprotocol:osp-master Oct 17, 2026
1 check failed
@HugeFrog24
HugeFrog24 deleted the feature/chat-flag-decoder branch October 17, 2026 19:24
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