kcsan_begin_scoped_access(9)
π kcsan_begin_scoped_access(9) β the Kernel API Manual glow-up
okay so bestie, we're in the Kernel API Manual today and the main character is kcsan_begin_scoped_access. yes, that's a whole mouthful, we love her anyway π«Ά
β¨ NAME β¨
kcsan_begin_scoped_access β literally the "begin scoped access" girlie β¨
π SYNOPSIS π
struct kcsan_scoped_access * kcsan_begin_scoped_access (const volatile
void *ptr , size_t size , int type , struct kcsan_scoped_access *sa );
like, copy it exactly, no cap π
πΈ ARGUMENTS πΈ
ptrβ the address of the access. that's the spot you're looking at πsizeβ the size of the access. how many bytes we're talking about πtypeβ the access type modifier. the vibe check on what kind of access this issaβ thestruct kcsan_scoped_accessyou're gonna use for the scope of the access. she's the one holding it down for the whole duration π«Ά
π¦ DESCRIPTION π¦
so what this does is: begin a scoped access, and initialize sa. and because of that, KCSAN will continuously check the memory range in the current thread until kcsan_end_scoped_access is called for sa. like it just keeps watching, every single time, until you tell it to stop π
and how does that actually work? scoped accesses are implemented by appending sa to an internal list for the current execution context β that's the little home she lives in β and then she gets checked on every call into the KCSAN runtime. every. single. one. iconic behavior, honestly π
π SEE ALSO π
everything's hanging out in the kernel file ./include/linux/kcsan-checks.h β go say hi to the whole friend group:
__kcsan_check_access(9)__kcsan_mb(9)__kcsan_wmb(9)__kcsan_rmb(9)__kcsan_release(9)kcsan_disable_current(9)kcsan_enable_current(9)kcsan_nestable_atomic_begin(9)kcsan_nestable_atomic_end(9)kcsan_flat_atomic_begin(9)kcsan_flat_atomic_end(9)kcsan_atomic_next(9)kcsan_set_access_mask(9)kcsan_end_scoped_access(9)__kcsan_check_read(9)__kcsan_check_write(9)__kcsan_check_read_write(9)kcsan_check_read(9)kcsan_check_write(9)kcsan_check_read_write(9)ASSERT_EXCLUSIVE_WRITER(9)ASSERT_EXCLUSIVE_WRITER_SCOPED(9)ASSERT_EXCLUSIVE_ACCESS(9)ASSERT_EXCLUSIVE_ACCESS_SCOPED(9)ASSERT_EXCLUSIVE_BITS(9)
kcsan to you too, bestie π
and that's the whole page!! mwah π sign-off time: this one lives in ./include/linux, dated October 2026, and it's the kcsan_begin_scoped_access(9) girlie herself. periodt. π
β¨
π¦ 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