Skip to content

fix: handle hex2uint64 hitcode overlap for XZ2 Premium (aurora)#3

Open
hirorogo wants to merge 1 commit into
j4nn:masterfrom
hirorogo:fix/xz2-premium-hitcode-overlap
Open

fix: handle hex2uint64 hitcode overlap for XZ2 Premium (aurora)#3
hirorogo wants to merge 1 commit into
j4nn:masterfrom
hirorogo:fix/xz2-premium-hitcode-overlap

Conversation

@hirorogo

@hirorogo hirorogo commented Mar 1, 2026

Copy link
Copy Markdown

Summary

  • Fixes test5 failure on XZ2 Premium (SOV38/aurora_kddi) where larger USB buffer requires overflow size 0x430f90 instead of default 0x400f90
  • The larger overflow corrupts hex2uint64 at ABL 0x006CFC, causing "FAILFailed to get the number of bytes to download"
  • Adds a short branch trampoline at 0x0c500x0c58 to avoid the 8-byte hitcode overlap with 0x0bf8, then places a full hitcode at 0x0c58

Details

Related issue: #2

On XZ2 Premium, the USB buffer is larger than on the regular XZ2. The correct overflow size found via -3 binary search is 0x430f90:

$ ./xperable -B -U -s 0x430f90 -3
[+] test3 succeeded: distance = 0x41cc00, hit from 0x032274, base = 0x988c5000

At this size, the overflow reaches hex2uint64 at 0x006CFC (buffer position 0x0c50), which was previously commented out due to overlap with the 0x0bf8 hitcode (0x0bf8 + 0x60 = 0x0c58 > 0x0c50).

The fix places b #0x08 (ARM64: 0x14000002) at 0x0c50, which only overwrites the far branch at offset 0x58 of the 0x0bf8 hitcode (used for unmatched sentinel hits). A full hitcode is then placed at 0x0c58 to handle the hex2uint64 hit.

This change does not affect regular XZ2 behavior — the hitcode at 0x0c58 is only triggered when the overflow reaches 0x006CFC.

Parameter XZ2 (default) XZ2 Premium
size 0x400f90 0x430f90
distance 0x3fa000 0x41cc00
base addr 0x988c1000 0x988bd000
hex parser fix not needed required

Test plan

  • Tested on SOV38 (aurora_kddi) with bootloader 1310-7079_X_Boot_SDM845_LA2.0_P_118
  • Successfully unlocked bootloader via oem unlock Y
  • Built and tested on macOS Apple Silicon with libusb 1.0.29

🤖 Generated with Claude Code

On XZ2 Premium (SOV38/aurora_kddi), the required overflow size is
0x430f90 (larger than the default 0x400f90 for XZ2). This causes
the overflow to corrupt hex2uint64 at ABL 0x006CFC, which maps to
buffer position 0x0c50. The hitcode at 0x0c50 was disabled because
it overlaps with the 0x0bf8 hitcode (0x0bf8 + 0x60 = 0x0c58 > 0x0c50).

Fix: place a short branch (b #0x08) at 0x0c50 to redirect to 0x0c58,
then place the full hitcode at 0x0c58. This preserves the 0x0bf8
hitcode's data word at 0x0c54 while properly handling the hex parser hit.

This fix does not affect the regular XZ2 behavior since the hitcode at
0x0c58 is only triggered when the overflow reaches 0x006CFC.

Tested on SOV38 with bootloader 1310-7079_X_Boot_SDM845_LA2.0_P_118.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant