Linux 7.3 brings 'More powerful binfmt_misc for sophisticated distros' (eg NixOS)

Just stumbled upon this great piece of news at Linux_7.3 - Linux Kernel Newbies :

This release extends the binfmt_misc format registry so a binary type can be matched programmatically and its interpreter computed per exec instead of being a fixed string recorded at registration time. This allows Nix and others to e.g., implement relocatable binaries without patchelf tricks or wrapper scripts, because the interpreter/dynamic loader can be determined programatically, say found relative to the binary. The mechanism is flexible and can support other policies

26 Likes

Nix might have had something to do with it.

12 Likes

$ORIGIN support in PT_INTERP is a neat idea, but I’m going to be very unhappy if I can’t continue to disable eBPF at kernel build time. I hope we can get a version of the feature that doesn’t depend on that.

3 Likes

It may be worth advocating for that on the mailing list, IIRC that was @fzakaria’s original idea but they walked it back for (possibly) compat reasons.

1 Like

I think @Ericson2314 also inspired https://kernelnewbies.org/Linux_7.3#New_sandboxing_technique_with_failfs_.2B-_fchroot.282.29

3 Likes