fix(core): remove build path from firmware binary
What changed, and why it matters
This commit removes the full build directory path from the firmware binary by switching from __FILE__ to __FILE_NAME__ in two error-handling locations. The change reduces information leakage but does not fix a memory corruption or logic bug. It is a hardening/information-disclosure reduction patch, not a fix for an actively exploitable vulnerability.
Treat as a minor hardening improvement. No urgent action required. If auditing the firmware supply chain, verify that reproducible builds and binary diffing no longer expose builder-specific paths.
Security signals we found
Information disclosure reduction: build path embedded in firmware binary removed
Use of __FILE_NAME__ instead of __FILE__ in fatal error macros
No functional change to syscall handling or access-violation logic
Evidence from the diff
The patch replaces FILE with FILE_NAME in syscall_dispatch.c and syscall_probe.h. FILE expands to the absolute source path on the build machine, which gets embedded into the firmware binary in fatal-error strings. FILE_NAME expands only to the source file basename, removing the build path prefix. This reduces the binary’s information content about the build environment and may slightly shrink binary size, but it does not change any control flow, syscall validation, or access-violation logic.
Changed components
core/embed/sys/syscall/stm32/syscall_dispatch.ccore/embed/sys/syscall/stm32/syscall_probe.hInspect captured patch +4 / −4
diff --git a/core/embed/sys/syscall/stm32/syscall_dispatch.c b/core/embed/sys/syscall/stm32/syscall_dispatch.c
index c38e83ee..3f6167e1 100644
--- a/core/embed/sys/syscall/stm32/syscall_dispatch.c
+++ b/core/embed/sys/syscall/stm32/syscall_dispatch.c
@@ -1023,7 +1023,7 @@ __attribute((no_stack_protector)) void syscall_handler(uint32_t *args,
#endif
default:
- system_exit_fatal("Invalid syscall", __FILE__, __LINE__);
+ system_exit_fatal("Invalid syscall", __FILE_NAME__, __LINE__);
break;
}
}
diff --git a/core/embed/sys/syscall/stm32/syscall_probe.h b/core/embed/sys/syscall/stm32/syscall_probe.h
index 2c69ecb7..fc559f75 100644
--- a/core/embed/sys/syscall/stm32/syscall_probe.h
+++ b/core/embed/sys/syscall/stm32/syscall_probe.h
@@ -46,9 +46,9 @@ void handle_access_violation(const char *file, int line);
// Exits the current application task with an fatal error
// with the message "Access violation".
-#define apptask_access_violation() \
- do { \
- handle_access_violation(__FILE__, __LINE__); \
+#define apptask_access_violation() \
+ do { \
+ handle_access_violation(__FILE_NAME__, __LINE__); \
} while (0)
#endif // KERNEL
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.