Skip to content
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

Improve stack protection on STM32U5 #3402

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

cepetr
Copy link
Contributor

@cepetr cepetr commented Nov 14, 2023

This pull request introduces better stack overflow protection for STM32U5 (Cortex-M33) by configuring the MSPLIM register and managing the UsageFault exception. The initial implementation utilizing MPU has been removed.

This change has a minor impact on older models since UsageFault and BusFault are now enabled in production firmware, bootloader, and the bootloader as well (fault_handlers_init() called in main()).

@cepetr cepetr added T2B1 Trezor Safe 3 T2T1 Trezor Model T T3T1 labels Nov 14, 2023
@cepetr cepetr requested a review from prusnak as a code owner November 14, 2023 13:53
@cepetr cepetr self-assigned this Nov 14, 2023
@cepetr cepetr force-pushed the cepetr/u5/trustzone-refactor branch from 8ceb837 to f285c41 Compare November 14, 2023 15:13
@cepetr cepetr force-pushed the cepetr/u5/stackprot-refactor branch from 911ba17 to c5efd3f Compare November 14, 2023 15:14
Base automatically changed from cepetr/u5/trustzone-refactor to tychovrahe/u5/basic_support November 15, 2023 09:16
Copy link
Contributor

@TychoVrahe TychoVrahe left a comment

Choose a reason for hiding this comment

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

looks good, bootloader_ci is missing the modification of startup + linker script

core/embed/firmware/main.c Outdated Show resolved Hide resolved
core/embed/firmware/main.c Outdated Show resolved Hide resolved
@cepetr
Copy link
Contributor Author

cepetr commented Nov 15, 2023

I've added stack overflow checking to bootloader_ci, see 3f94ef5

@andrewkozlik andrewkozlik removed their request for review November 15, 2023 12:54
@cepetr cepetr force-pushed the cepetr/u5/stackprot-refactor branch from 3f94ef5 to 64508fa Compare November 15, 2023 14:44
@cepetr cepetr merged commit 3cdf755 into tychovrahe/u5/basic_support Nov 15, 2023
7 of 9 checks passed
@cepetr cepetr deleted the cepetr/u5/stackprot-refactor branch November 15, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2B1 Trezor Safe 3 T2T1 Trezor Model T T3T1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants