fw/services/process_management: allow unaligned relocation targets#1792
Merged
Conversation
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>
gmarull
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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