Skip to content

Manually allocate callee-saved registers so values don't get overwritten in fault rejection - #55

Merged
JamesHuard merged 1 commit into
OpenDevicePartnership:mcxa-secure-bootfrom
diondokter:fault-rejection-fix
Oct 23, 2026
Merged

JamesHuard merged 1 commit into
OpenDevicePartnership:mcxa-secure-bootfrom
diondokter:fault-rejection-fix

Conversation

@diondokter

Copy link
Copy Markdown
Member

This should fix what @alamfarjadf saw here: #50 (comment)

What happened was that one of the allocated registers was the LR register. I don't know why that's being picked as it sounds like a terrible choice.
The value would get overwritten by the first bl instruction which caused the body closure to not get called (properly).

By allocating the registers manually, we know they're ok to use. In the disassembly I can also see these registers are pushed and popped to/from the stack as they should.

@jerrysxie jerrysxie added this to EC Oct 20, 2026
@jerrysxie jerrysxie moved this to In Progress in EC Oct 20, 2026

@JamesHuard JamesHuard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It auto'd LR?! Thanks, inline assembly. Clearly the most reasonable thing to do here.

@JamesHuard
JamesHuard enabled auto-merge (squash) October 20, 2026 15:15
@alamfarjadf

Copy link
Copy Markdown

This would be a comment for PR 50, but I'll add it here: might make sense to use the NbootBool instead of just a generic bool in Dev Mode Impl, this can be (if implemented) in your upcoming PR, not really for this PR.

@alamfarjadf

Copy link
Copy Markdown

Aonther comment: Wouldn't make more sense to do the DEV mode RKTH copy in verification.rs once the body executes and we are in the okay arm, instead of copying in the body itself?

Comment thread libs/fault-rejection/src/arm_eabi.rs
@alamfarjadf

Copy link
Copy Markdown

On device testing and assembly for this PR checks out okay. I think we are good to merge pending responses to comments.

@diondokter

Copy link
Copy Markdown
Member Author

I'll look at it tomorrow, but most of these comments don't pertain to the PR at hand. It'd be better to open an issue and discus there instead of holding up this fix that seemingly works

@alamfarjadf

Copy link
Copy Markdown

I'll look at it tomorrow, but most of these comments don't pertain to the PR at hand. It'd be better to open an issue and discus there instead of holding up this fix that seemingly works

Agreed, this one is all set. We can merge.

@alamfarjadf

Copy link
Copy Markdown

@JamesHuard @felipebalbi Can this one be merged? Our PRs using ToT of this branch once boot.

@JamesHuard
JamesHuard merged commit fdd29a1 into OpenDevicePartnership:mcxa-secure-boot Oct 23, 2026
9 checks passed
@felipebalbi

Copy link
Copy Markdown
Contributor

@JamesHuard @felipebalbi Can this one be merged? Our PRs using ToT of this branch once boot.

done, it just needed a rebase and a "resolve conversation" on your own question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants