KUBSAN(4)

πŸ“¦ in nixpkgs unstable

πŸ’– NAME πŸ’–

kubsan β€” kernel undefined behavior sanitizer. And yes bestie, this is kubsan(4) from the Kernel Interfaces Manual β€” group-chat approved, terminal-ready πŸ’…βœ¨


🌸 SYNOPSIS 🌸

option KUBSAN

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so kubsan detects undefined behavior at runtime inside the kernel πŸ”₯ Detected undefined behavior gets printed to the system console, including the offending line in the source code β€” so you can literally see where the chaos happened 😭

By default, kubsan is not enabled, but instead requires the following line to be present in the kernel configuration:

option KUBSAN

The following undefined behavior is detected:

  • Float cast overflow β€” the conversion from a floating point to an integer cannot be represented by the destination type πŸ’€
  • Integer overflow β€” the result of an arithmetic computation on two integer operands cannot be represented by the destination type.
  • Negate overflow β€” negation of an integer cannot be represented by the destination type.
  • Pointer overflow β€” pointer arithmetic overflow.
  • Out of bounds β€” array indexing out of bounds, limited to cases where the size of the array can be statically determined πŸ‘‘
  • Shift out of bounds β€” undefined logical shift caused by:
    • The shift amount being negative.
    • The shift operand being negative.
    • The shift amount exceeds the number of bits as given by the shift operand type.
    • The result of the shift computation cannot be represented by the destination type.
  • Non-null argument β€” passing NULL as the value for a function argument annotated with __nonnull__ πŸ™ˆ
  • Invalid builtin β€” passing zero to a compiler builtin where not allowed.
  • Invalid load β€” loading a value that cannot be represented by the destination type.
  • Type mismatch β€” mismatch between pointer and value type caused by:
    • A pointer which does not fulfill the alignment requirements of the value type.
    • A pointer to an address which lacks sufficient space to store the value type.
  • Unreachable β€” execution reached passed a function annotated with __dead πŸ’€

πŸŽ€ SEE ALSO πŸŽ€

  • options(4) β€” go read that too, bestie 🫢

🌈 HISTORY 🌈

The kubsan implementation is derived from NetBSD and first appeared in OpenBSD 6.5. iconic behavior, no cap ✨

πŸ’œ AUTHORS πŸ’œ

The kubsan implementation was written by Anton Lindqvist <anton@openbsd.org> 🫢

⭐ CAVEATS ⭐

The kubsan implementation is limited to architectures using clang(1) as their default compiler. that's the vibe check, fr fr πŸ’…


Debian edition, dated September 6, 2024 β€” that's the footer tea bestie, slay and stay safe out there πŸ«ΆπŸ’–

πŸ“¦ where this page comes from
  • nixpkgs unstable: cvs-export
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms