Repository navigation
mm/ubsan: add missing handlers and never report recursively - #22279
Merged
xiaoxiang781216 merged 2 commits intoNov 25, 2026
Merged
Conversation
Add __ubsan_handle_vla_bound_not_positive() and __ubsan_handle_nonnull_return_v1(), which code built with -fsanitize=vla-bound or -fsanitize=returns-nonnull-attribute calls, and their empty versions for CONFIG_MM_UBSAN_DUMMY. Assisted-by: Kiro:claude-opus-5-5 Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Printing a report goes through syslog(), which touches the TLS task info. Early in boot on x86_64 that access itself trips a type-mismatch check, the handler is re-entered from inside ubsan_prologue(), and the recursion continues until the stack is exhausted (77k frames observed). Track an in-progress report and make ubsan_prologue() refuse a nested one, so the handlers return without printing. Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
xiaoxiang781216
approved these changes
Nov 24, 2026
GUIDINGLI
approved these changes
Nov 24, 2026
|
This file contains hidden or 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
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.
Note: Please adhere to Contributing Guidelines.
Summary
UBSAN changes from Xiaomi Vela, split out of #22206 as asked in its review.
__ubsan_handle_vla_bound_not_positive()and__ubsan_handle_nonnull_return_v1(), which code built with-fsanitize=vla-boundor-fsanitize=returns-nonnull-attributecalls, and their empty versions forCONFIG_MM_UBSAN_DUMMY.syslog(); when that trips another check (seen early in boot on x86_64), the handler was re-entered until the stack overflowed. A nested report now returns without printing.Impact
Testing
Host: Ubuntu 22.04 x86_64, GCC 13.4.0, CMake 3.23 + Ninja 1.10. Base: master 25b649e.
./tools/checkpatch.sh -c -u -m -g HEAD~2..HEADpasses.sim:ostest(KASAN and UBSAN): a 320 s run completes one ostest pass with no KASAN/UBSAN report; apart from the delays printed by hrtimer_test, the output is the same as master's.Not tested: the x86_64 boot case, real hardware.