Repository navigation
UBSan - #26
Merged
Merged
UBSan#26
Conversation
Latest GCC & Binutils + a few nice fixes. While at it, unhardcode the CI GCC version so it is fetched dynamically. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
The shift in BIT_OF_TYPE() promotes any type narrower than int to int, so BIT_U8() and BIT_U16() produced a signed int, which BIT_FIELD_READ() then rejects as a field mask. Cast the result back to the requested type. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Lets code that serializes itself against other callers, such as the console flush, get out of the panic path's way. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
A print from inside a flush, e.g. a WARN() in a console driver or an interrupt that logs mid write, flushed again and clobbered the static buffers the outer flush was still using. Registering a console flushed the same way with no protection at all. Let only one caller flush at a time. A nested caller leaves its record in the ring and marks the flush pending for the owner to pick up. A panic flushes regardless, since the flush it interrupted never resumes. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
A reader that knows an unpublished record will never be finished, e.g. one printing a panic, needs a way to get to the records after it. Add log_ring_read_with_flags() and LOG_RING_READ_SKIP_UNPUBLISHED for that, log_ring_read() stays the plain form. The newest record is never skipped since its writer may still be running. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
A panic that interrupts a print between reserving its record and publishing it, e.g. from an interrupt handler, leaves that record unpublished forever. The flush stopped there, so none of the panic output ever reached a console. Skip such records while a panic is in progress. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Other reporters of non-fatal kernel problems should end their report the same way a WARN() does, so panic_on_warn applies to them too. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
It lets a helper called from any subdirectory set source file properties on the kernel objects via set_property(SOURCE ... TARGET_DIRECTORY). Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
d-tatianin
force-pushed
the
sanitizers
branch
2 times, most recently
from
September 28, 2026 21:31
419ed73 to
cbc86c8
Compare
UBSAN support for both the GCC and Clang toolchains, behind a config option in the debug sub-menu, opt-in support per architecture. The one quirk is that only Clang supports relative report locations via "-fsanitize-undefined-strip-path-components=", while GCC has no such option, so we just keep absolute paths there. Enum checks are left out since neither compiler instruments them for C. Division by zero is GCC only, clang treats the code after its handler as unreachable, so a report that returns runs off the function. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
d-tatianin
force-pushed
the
sanitizers
branch
from
September 28, 2026 21:34
cbc86c8 to
0aa604e
Compare
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.
No description provided.