unlink_binfmt_handler(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the glow-up of unlink_binfmt_handler(9) ✨ this is a kernel API manual page and honestly? it's giving "short but does the most" πŸŽ€


🌸 NAME 🌸

unlink_binfmt_handler β€” unhash a binary type handler, that's literally it, that's the whole job πŸ’…


✨ SYNOPSIS ✨

void unlink_binfmt_handler (struct binfmt_misc *misc , struct
binfmt_misc_entry *e );

no cap, that's the exact signature, copied character for character because we do not play with kernel prototypes πŸ™ˆ


🫢 ARGUMENTS 🫢

  • misc β€” the handle to your binfmt_misc instance. like, which one. there are several. it needs to know 🌈
  • e β€” the binary type handler you're un-hashing. yes, this one. bye bestie πŸ‘‹

πŸ’– DESCRIPTION πŸ’–

so here's the tea, and it's actually kind of iconic πŸ“

Adding and removing entries via bm_{entry,register,status}_write and unlink(2) all happens under the exclusively held inode lock of the root dentry β€” which is what keeps the list stable for the writers. main character lock energy, honestly πŸ‘‘

Meanwhile load_misc_binary walks that list concurrently under SRCU. so the lock isn't holding everybody hostage, it's just doing its little job πŸ¦‹

And entries_lock? it's only held around the actual unlink, purely to serialize against bm_evict_inode, which unlinks entries during umount without holding the root inode lock. so entries_lock is the tiny bouncer at the door for exactly that one situation πŸ’€

fr fr, if you're touching this, respect the lock discipline β€” the description is very specific about which lock is held where and why, and that's not decorative ✨

🧚 SEE ALSO 🧚

Kernel file ./fs/binfmt_misc.c, plus the whole friend group:

iykyk πŸ”₯


aaaand that's the page!! πŸŽ€ this masterpiece lives in ./fs and it's dated October 2026 β€” mwah, slay, periodt πŸ’œ

πŸ“¦ where this page comes from