kmsan_report(9)
π kmsan_report β from the Kernel API Manual, bestie
So likeβ¦ kmsan_report(9) is the kernel API page you're reading right now, and honestly it's giving "small function, big drama" because its whole job is snitching on uninitialized memory. Let's get into it π«Ά
β¨ NAME β¨
kmsan_report β Report a use of uninitialized value. Yeah. It's the tattletale. It's the one who tells on your uninit'd bytes. π
π SYNOPSIS π
void kmsan_report (depot_stack_handle_t origin , void *address , int
size , int off_first , int off_last , const void __user *user_addr ,
enum kmsan_bug_reason reason );
That's the whole vibe. Seven arguments, no cap. Copy it exactly, bestie, this is not a "close enough" situation π
πΈ ARGUMENTS πΈ
originβ Stack ID of the uninitialized value. It's literally the receipt showing where the sketchy value came from π§Ύaddressβ Address at which the memory access happens. i.e. the scene of the crime πsizeβ Memory access size. How much memory we're talking about, in bytes.off_firstβ Offset (fromaddress) of the first byte to be reported. The start of the juicy part πoff_lastβ Offset (fromaddress) of the last byte to be reported. The end of it. Bookends πuser_addrβ When non-NULL, denotes the userspace address to which the kernel is leaking data. π¨ Non-NULLhere means the kernel is leaking data to userspace β that's the spicy, please-look-at-this-immediately case.reasonβ Error type fromenum kmsan_bug_reason. The "why are we even here" field.
π¦ DESCRIPTION π¦
So kmsan_report prints an error message for a consequent group of bytes sharing the same origin. Grouped by origin, bestie. It's matching sets only β¨
Now here's the nuance, pay attention π If an uninitialized value is used in a comparison, this function is called once without specifying the addresses. That's it. One call. No addresses. Don't @ me.
But when checking a memory range, KMSAN may call kmsan_report multiple times with the same address, size, user_addr and reason, but different off_first and off_last corresponding to different origin values. So like β same address, same size, same user_addr, same reason, but the offsets shuffle around because the origins are different. Multiple calls, same identity crisis, different offsets. Periodt π
π SEE ALSO π
- Kernel file
./mm/kmsan/kmsan.hβ go read it, iykyk π
Fr fr, none of this is vibes-based guessing β every flag and field above is straight from the source, and KMSAN does not play about uninitialized memory π
π Okay that's the whole page, mwah! This absolute icon of a doc lives in ./mm/kmsan and the manual dates it to October 2026, so likeβ¦ future-coded but also extremely now. Stay uninit-free, bestie πππ«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms