cap_inode_setxattr(9)
π cap_inode_setxattr β the kernel API manual, bestie edition π
okay so this is cap_inode_setxattr, and it lives in the Kernel API Manual section (9). Yes bestie, section 9 β that's the kernel-internals one. Buckle up. π¦
β¨ NAME β¨
cap_inode_setxattr β the little function that decides whether an xattr is even allowed to be altered. It's the bouncer at the club door for extended attributes. π
πΈ SYNOPSIS πΈ
int cap_inode_setxattr (struct dentry *dentry , const char *name , const
void *value , size_t size , int flags );
Look at that signature. Gorgeous. Iconic. Returns an int, takes five args, and yes you need all of them. π«Ά
π ARGUMENTS π
dentryβ the inode/dentry that's getting altered. the main character of this whole operation tbh πnameβ the name of the xattr that's about to be changed π·οΈvalueβ the value that the xattr will be changed to. like, the glow-up it's getting β¨sizeβ the size ofvalue. how big the glow-up is πflagsβ the replacement flag π©
π DESCRIPTION π
So what does it actually do? It determines whether an xattr may be altered or set on an inode, and it hands back 0 if permission is granted, or -ve if it's denied. That's it. That's the vibe check. π
Lowkey the important part: this is used to make sure security xattrs don't get updated or set by people who aren't privileged to do so. No cap β it's a security gate, and it takes that job very seriously. π₯
fr fr, don't treat the return value as a suggestion.0= go,-ve= absolutely not, bestie. π
π¦ SEE ALSO π¦
Kernel file ./security/commoncap.c β go read it if you're built different β and the whole squad, in this exact order, no skipping:
cap_capable_helper(9)cap_capable(9)cap_settime(9)cap_ptrace_access_check(9)cap_ptrace_traceme(9)cap_capget(9)cap_capset(9)cap_inode_need_killpriv(9)cap_inode_killpriv(9)kuid_root_in_ns(9)rootid_from_xattr(9)cap_convert_nscap(9)get_vfs_caps_from_disk(9)cap_bprm_creds_from_file(9)cap_inode_removexattr(9)cap_task_fix_setuid(9)cap_task_setscheduler(9)cap_task_setioprio(9)cap_task_setnice(9)cap_task_prctl(9)cap_vm_enough_memory(9)cap_mmap_addr(9)
π the cute sign-off π
this page came out of the ./security directory, dated October 2026, and it's officially the cap_inode_setxattr(9) page β so you literally cannot get lost. iykyk. mwah ππ
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