cap_inode_removexattr(9)
π cap_inode_removexattr β the manual page bestie
okay so bestie, this is a Kernel API Manual page for cap_inode_removexattr(9), and no cap it's lowkey iconic β it's the little gatekeeper that decides whether an extended attribute is allowed to get yeeted off an inode. β¨
β¨ NAME β¨
cap_inode_removexattr β literally the function that determines whether an xattr may be removed. that's it, that's the whole vibe check. π
πΈ SYNOPSIS πΈ
int cap_inode_removexattr (struct mnt_idmap *idmap , struct dentry *dentry , const char *name );
π¦ ARGUMENTS π¦
idmapβ the idmap of the mount the inode was found from. yes it's a whole parameter, don't skip it πdentryβ the inode/dentry being altered. this is the main character, the thing we're messing with π«Άnameβ the name of the xattr to be changed. like, which one, bestie? be specific πΈ
π₯ DESCRIPTION π₯
So what it do: it determines whether an xattr may be removed from an inode, returning 0 if permission is granted, and -ve if it's denied. that's the whole deal β 0 means slay, negative means absolutely not. π
Now the important bit, and honestly this is giving very careful: if the inode has been found through an idmapped mount, the idmap of the vfsmount must be passed through idmap. This function will then take care to map the inode according to idmap before checking permissions. β¨
on non-idmapped mounts, or if the permission checking is to be performed on the raw inode, just simply pass nop_mnt_idmap. easy. no stress. π
And why do we even care? This is used to make sure security xattrs don't get removed by those who aren't privileged to remove them. it's giving bodyguard energy fr fr β the unprivileged do NOT get to touch the security xattrs, periodt. π
π SEE ALSO π
Kernel file ./security/commoncap.c β and here's the whole friend group, every single one, no gatekeeping:
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_setxattr(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)
that's the page bestie, you ate it up π
β¨ and real quick, the cute lil sign-off credits: this one lives in ./security and it's dated October 2026. mwah ππ¦π
π¦ 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