bpf_set_dentry_xattr_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_set_dentry_xattr_locked(9) β€” from the Kernel API Manual, bestie ✨

okay so picture this: you're deep in kernel-land, you've got a dentry, you've got an xattr name, you've got a value, and you just need to stick that value onto that dentry. that's this function. it's giving lowkey niche but highkey iconic. let's get into it 🫢


✨ NAME ✨

bpf_set_dentry_xattr_locked β€” set a xattr of a dentry πŸ’–


🌸 SYNOPSIS 🌸

int bpf_set_dentry_xattr_locked (struct dentry *dentry , const char
       *name__str , const struct bpf_dynptr *value_p , int flags );

like, that's the whole signature, no notes, she's beautiful 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • dentry β€” the dentry you're pulling the xattr from. that's the main character right there πŸ‘‘
  • name__str β€” the name of the xattr. and yes bestie, the double underscore is real, that's not a typo, write it exactly like that πŸ’€
  • value_p β€” the xattr value. this is the actual payload, the vibe, the content 🌈
  • flags β€” flags that get passed straight into filesystem operations. so whatever the fs wants, the fs gets 🧚

πŸ¦‹ DESCRIPTION πŸ¦‹

so what she actually does: she sets the xattr name__str of dentry to the value in value_ptr. that's the whole assignment. slay ✨

⚠️ and now the important part, no cap: for security reasons, only name__str with the prefix "security.bpf." is allowed. that's not a suggestion, that's the rule. anything else? not today, bestie πŸ™ˆ

also, heads up: the caller already locked dentry->d_inode. that's on you, not on her. she's not doing the locking, she's just showing up to a party that's already locked (in a good way) πŸ”₯


⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • a negative value on error 😭

that's it. binary queen. periodt πŸ’…


πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./fs/bpf_fs_kfuncs.c β€” that's where the magic lives πŸ“

and the whole friend group, obviously:

like, the whole xattr cinematic universe fr fr 🌸


okay and finally, the lil sign-off: this page comes from ./fs, dated October 2026, and it's all about bpf_set_dentry_xattr_locked(9). mwah πŸ’‹ go forth and set those xattrs, but only the "security.bpf." ones, iykyk πŸŽ€

πŸ“¦ where this page comes from