Skip to content

boot: bootutil: declare fih_panic_loop() as noreturn #2371

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ extern fih_ret FIH_BOOT_HOOK_REGULAR;
/* Global failure handler - more resistant to unlooping. noinline and used are
* used to prevent optimization
*/
__attribute__((noinline)) __attribute__((used))
__attribute__((noinline)) __attribute__((used)) __attribute__((noreturn))
void fih_panic_loop(void);
#define FIH_PANIC fih_panic_loop()
#else
Expand Down
6 changes: 6 additions & 0 deletions boot/bootutil/src/fault_injection_hardening.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void fih_cfi_decrement(void)
*/
__attribute__((used))
__attribute__((noinline))
__attribute__((noreturn))
void fih_panic_loop(void)
{
__asm volatile ("b fih_panic_loop");
Expand All @@ -74,5 +75,10 @@ void fih_panic_loop(void)
__asm volatile ("b fih_panic_loop");
__asm volatile ("b fih_panic_loop");
__asm volatile ("b fih_panic_loop");

/* An infinite loop to suppress compiler warnings
* about the return of a noreturn function
*/
while (1) {}
}
#endif /* FIH_ENABLE_GLOBAL_FAIL */
Loading