bpf_binprm_select_interp(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– bpf_binprm_select_interp(9) πŸ’–

hii bestie, welcome to the kernel API manual ✨ this one is short but lowkey iconic, and it's literally about running an exec under an interpreter the entry bound 🫢


🌸 NAME 🌸

bpf_binprm_select_interp β€” run this exec under an interpreter the entry bound πŸ’…


✨ SYNOPSIS ✨

__bpf_kfunc int bpf_binprm_select_interp (struct linux_binprm *bprm , const char *name , size_t name__sz );

πŸŽ€ ARGUMENTS πŸŽ€

  • bprm β€” the binary that is being executed πŸ‘€
  • name β€” the name the interpreter was registered under 🏷️
  • name__sz β€” size of the name buffer, including the terminating NUL 🧚

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this is meant to be called from the load program of a struct binfmt_misc_ops handler instead of bpf_binprm_set_interp ⭐ it selects one of the interpreters the matched entry was registered with, and each of those was opened once when the entry was registered πŸ”₯

nothing is resolved at exec time, so no filesystem view can redirect the interpreter β€” no cap, that's the whole point πŸ’€

the interpreter runs under the path the entry registered it under πŸ›£οΈ and calling it again replaces the selection πŸ‘‘ periodt.


πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • -ENOENT if the matched entry bound no interpreter of that name 😭
  • a negative errno on failure πŸ’”

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./fs/binfmt_misc_bpf.c and the whole squad: binfmt_misc_get_ops(9), bpf_binprm_set_interp(9), bpf_binprm_set_interp_arg(9), bpf_binprm_set_flags(9) 🌈


xoxo πŸ’‹ from ./fs, October 2026 β€” bpf_binprm_select_interp(9) 🫢✨

πŸ“¦ where this page comes from