-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC: Automatically control system_mode in hardware using a "blessed" address #299
Draft
dehanj
wants to merge
7
commits into
main
Choose a base branch
from
syscall_jmp_to_address_to_enable_fw_mode_persist
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
4 times, most recently
from
November 15, 2024 12:53
4151eed
to
8fe67fe
Compare
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
from
November 15, 2024 13:25
8fe67fe
to
dd514d9
Compare
We can potentially simplify the check due to unsigned arithmetic
But we might want to show intent, and if ROM moves it might lower the risk for a bug. EDIT: |
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
from
November 18, 2024 09:14
dd514d9
to
d6ad383
Compare
dehanj
force-pushed
the
persistant_storage_fw_
branch
from
November 19, 2024 12:29
a32be6f
to
b7ba452
Compare
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
3 times, most recently
from
November 21, 2024 08:55
b1da566
to
d35d2d6
Compare
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
2 times, most recently
from
November 21, 2024 12:35
8da93ec
to
d88af31
Compare
agren
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
from
November 22, 2024 14:27
d88af31
to
221d673
Compare
Add a register to store an address to a syscall function defined in firmware. Set the reset value to an illegal address, to make sure a call to an unset address will halt the CPU. Co-authored-by: Mikael Ågren <[email protected]>
Raise privilege (go to firmware mode) when a function call occurs to the function set in syscall_addr_reg. Automatically revoke privilege when executing above ROM (go to app mode). Remove the option of writing to system_mode through the API. Co-authored-by: Mikael Ågren <[email protected]>
Co-authored-by: Mikael Ågren <[email protected]>
This is dynamically set by hw in system_mode_ctrl. ROM will reset to executable, but will be marked as non-executable as soon as we are no longer executing in ROM, like system_mode. ROM will be marked as executable again, if function calls are made to either `syscall_addr_reg` or `blake2s_addr_reg`. Set reset value of `blake2s_addr_reg` to an illegal address, halting the CPU if it is called unset. The blake2s function is 4-byte aligned, to ensure the cpu_addr is is aligned with the address in the register. Co-authored-by: Mikael Ågren <[email protected]>
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
from
December 9, 2024 08:41
221d673
to
d3e4455
Compare
After the first time system_mode is set to one, the assets will no longer be read- or writeable, even if system_mode is set to zero at a later syscall. This is to make sure syscalls does not have the same privilege as the firmware has at first boot. We need to monitor when system_mode is set to one, otherwise we might accedentially lock the assets before actually leaving firmware, for example if firmware would use a function set in any of the registers used in system_mode_ctrl. Co-authored-by: Mikael Ågren <[email protected]>
Updates Readme with: - Dynamic execution mode control in hardware - ROM execution - Syscall API - Sensitive assets only read-/writable before first switch to app mode - SPI master only accessible in firmware mode
dehanj
force-pushed
the
syscall_jmp_to_address_to_enable_fw_mode_persist
branch
from
December 9, 2024 12:27
d3e4455
to
c7e44d3
Compare
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.
Description
This is a proof of concept:
tkey-verification
that it works.The utilization in the FPGA does increase, but not significantly. We are at around 95-96% with this solution.
Built locally with yosys-45 and nextpnr-0.7.
In CI (older toolchain):
Notes:
system_mode
API, still readable however.persistant_storage_fw_
. Run the hardware and firmware on target using apps with latest commits intillitis/tkey-testapps:storage
.tillitis/qemu:test-wo-app-mode
and apps fromtillitis/tkey-testapps:storage
latest commit.Type of change
Submission checklist