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
$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.
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.
I’m making the assumption that they didn’t want to add direct $ORIGIN support for compat reasons – literal $ORIGIN in a binary would have not worked before, and now would, which is a userspace behavior change that would not have been opt-in. (Perhaps if we wanted it without eBPF, it could be an opt-in config option?)
Anyway, it is an assumption, @fzakaria participated directly in the thread and I’m curious what the reasoning boiled down to.
I want to see this relocatable binaries for a long time – so when someone gives you a path to get there (olive branch), you accept it
All the reasons are in the thread and @numinit summary is pretty spot on.
We could do this at NixOS ourselves, but this will move the whole Linux landscape forward.