kmsan_report(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 (from address) of the first byte to be reported. The start of the juicy part 🌈
  • off_last β€” Offset (from address) 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-NULL here means the kernel is leaking data to userspace β€” that's the spicy, please-look-at-this-immediately case.
  • reason β€” Error type from enum 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