bpf_cgroup_read_xattr(9)
π¦ bpf_cgroup_read_xattr β read xattr of a cgroup's node in cgroupfs
okay bestie so this is a page from the Linux Kernel API Manual, section 9 β like, the kernel-API girlies section, not the "type man ls" section. it's bpf_cgroup_read_xattr, and it does exactly what it says on the tin. let's get into it π
β¨ NAME β¨
bpf_cgroup_read_xattr β read xattr of a cgroup's node in cgroupfs
literally that. you want a cgroup's extended attribute? this is the kfunc for you, no cap πΈ
π SYNOPSIS π
__bpf_kfunc int bpf_cgroup_read_xattr (struct cgroup *cgroup , const
char *name__str , struct bpf_dynptr *value_p );
that's the whole signature, character for character, don't @ me π«Ά
π ARGUMENTS π
cgroupβ the cgroup you wanna get the xattr from. your main character cgroup, basically πname__strβ the name of the xattr. (and yes, it really is spelled with that double underscore, that's the BTF magic, iykyk β¨)value_pβ the output buffer where the xattr value goes. it's astruct bpf_dynptr *, so it's giving "dynptr energy" fr fr
π₯ DESCRIPTION π₯
Get the xattr name__str of cgroup and store the output in value_ptr. that's the whole job, and it ate π
β οΈ ok so listen β for security reasons, onlyname__strwith prefix"user."is allowed. like, the kernel is doing a vibe check on your attribute name and if it doesn't start withuser.it is NOT coming to the party. periodt. so name it right or stay home π
β RETURN β
- length of the xattr value β on success, slay π
- a negative value β on error, and yes bestie a negative return is the kernel's way of saying "we're not okay" π
π SEE ALSO π
the kernel file lives at ./fs/bpf_fs_kfuncs.c β go read it, it's iconic. and here's the whole friend group, all of them, in order:
bpf_get_task_exe_file(9)bpf_put_file(9)bpf_path_d_path(9)bpf_get_dentry_xattr(9)bpf_get_file_xattr(9)bpf_set_dentry_xattr_locked(9)bpf_remove_dentry_xattr_locked(9)bpf_set_dentry_xattr(9)bpf_remove_dentry_xattr(9)bpf_sock_read_xattr(9)bpf_real_data_inode(9)
like a whole xattr cinematic universe, we love to see it π§β¨
and that's the page!! sourced from ./fs, dated October 2026 β yes, the future, because this kernel API is ahead of its time π mwah, go read your xattrs responsibly bestie π
π¦ 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