Skip to content

fw/services/process_management: allow unaligned relocation targets#1792

Merged
jplexer merged 1 commit into
coredevices:mainfrom
jplexer:jp/unaligned-reloc-targets
Jul 23, 2026
Merged

fw/services/process_management: allow unaligned relocation targets#1792
jplexer merged 1 commit into
coredevices:mainfrom
jplexer:jp/unaligned-reloc-targets

Conversation

@jplexer

@jplexer jplexer commented Jul 23, 2026

Copy link
Copy Markdown
Member

The v4.24.0 loader hardening required every relocation target to be word aligned. Legacy SDK apps can have pointer slots at halfword offsets inside packed structs, e.g. 91 Dub v4.0 has seven such relocations per platform binary and was rejected on launch with "Invalid app relocation target[16]: 0x39da". A scan of the 400 most popular Rebble store apps found five affected (91 Dub v4.0, Timely, Rosewright A, Rosewright Chronograph, Directions); all of them worked before the hardening because Cortex-M supports unaligned LDR/STR.

Drop the alignment requirement and access the slot bytewise via memcpy, mirroring the earlier fix for unaligned relocation table offsets. The bounds checks that actually prevent out of bounds writes in a privileged context are retained. Verified in QEMU (qemu_emery): 91 Dub v4.0 (basalt) and Rosewright A (emery) now load and render, and a current-SDK app still loads.

Fixes FIRM-3562

The v4.24.0 loader hardening required every relocation target to be
word aligned. Legacy SDK apps can have pointer slots at halfword
offsets inside packed structs, e.g. 91 Dub v4.0 has seven such
relocations per platform binary and was rejected on launch with
"Invalid app relocation target[16]: 0x39da". A scan of the 400 most
popular Rebble store apps found five affected (91 Dub v4.0, Timely,
Rosewright A, Rosewright Chronograph, Directions); all of them worked
before the hardening because Cortex-M supports unaligned LDR/STR.

Drop the alignment requirement and access the slot bytewise via
memcpy, mirroring the earlier fix for unaligned relocation table
offsets. The bounds checks that actually prevent out of bounds writes
in a privileged context are retained. Verified in QEMU (qemu_emery):
91 Dub v4.0 (basalt) and Rosewright A (emery) now load and render,
and a current-SDK app still loads.

Fixes FIRM-3562

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Joshua Jun <lets@throw.rocks>
@jplexer
jplexer requested a review from gmarull as a code owner July 23, 2026 14:39
@jplexer
jplexer merged commit 0afc2d9 into coredevices:main Jul 23, 2026
42 checks passed
@jplexer
jplexer deleted the jp/unaligned-reloc-targets branch July 23, 2026 18:41
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