STRUCT LSM_CTX(9)
π struct lsm_ctx(9) β bestie edition
okay so this is from the Kernel API Manual, section 9, and it's literally the whole tea on struct lsm_ctx β which, iykyk, is the LSM context information struct π
β¨ NAME β¨
struct lsm_ctx β LSM context information
Like, genuinely just the container for LSM context info. That's the vibe. πΈ
π¦ SYNOPSIS π¦
struct lsm_ctx {
__u64 id;
__u64 flags;
__u64 len;
__u64 ctx_len;
__u8 ctx[];
};
Look at her. Structurally iconic. The flexible array member at the end? main character energy fr fr π₯
π Members π
idβ the LSM id number, seeLSM_ID_XXXflagsβ LSM specific flagslenβ length of thelsm_ctxstruct,ctxand any other data or paddingctx_lenβ the size ofctxctxβ the LSM context value
π Description π
okay so the rules, and bestie these are MUST rules, not suggestions:
The len field MUST be equal to the size of the lsm_ctx struct plus any additional padding and/or data placed after ctx. no cap, it has to match exactly.
In all cases ctx_len MUST be equal to the length of ctx. And listen β if ctx is a string value, it should be nul terminated, with ctx_len equal to `strlen(ctx) + 1`. Binary values are supported too, so it's not just strings-only over here π«Ά
and now the part where you gotta respect boundaries: theflagsandctxfields SHOULD only be interpreted by the LSM specified byid. They MUST be set to zero/0 when not used. Like, don't be nosy about another LSM's fields, it's not cute π
π SEE ALSO π
Kernel file ./include/uapi/linux/lsm.h
π okay that's the whole page, go forth and initialize your structs correctly bestie, and remember: len and ctx_len are not optional vibes, they're requirements β¨
sign-off szn π this one's from ./include/uapi/linux, dated October 2026, logged forever in the KERNEL API MANUAL, and it ate. 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