patchelf
patchelf copied to clipboard
--set-interpreter lost compatibility with Linux 5.17 and below
Describe the bug
Linux 5.17 and below have a bug, later fixed by torvalds/linux@0da1d5002745cdc721bc018b582a8a9704d56c42. That bug was accounted for in patchelf, but a recent patch (43b75fbc9ffbc1190fee7c8693ad74cb8286cfd4) broke compatibility with these older kernels.
Steps To Reproduce
- patchelf --set-interpreter /path/to/new/interpreter
- patchelf allocates new sections at the end
- run on Linux 5.17 or below
- crash
I can supply a full reproducer if needed, but since the regression was deliberate, I don't think it's necessary. I can do it if required.
Expected behavior
A clear and concise description of what you expected to happen.
I'd like to restore compatibility with Linux 5.17, perhaps with a switch.
patchelf --version output
patchelf 0.18.0
Additional context
Running patchelf on Fedora 42 (patchelf-0.18.0-8.fc42.x86_64) and the patched binary on CentOS 9.
https://github.com/NixOS/patchelf/commit/43b75fbc9ffbc1190fee7c8693ad74cb8286cfd4 was fairly involved. Do you see a way to put the original behavior behind a flag in way that doesn't add significant complexity?
This sounds like a job for copilot, it would gladly take an instruction like that and generate a patch in a few minutes. As I don't know anything about patchelf, it would take me hours or days.
In fact, to solve the problem with this regression, I asked it to write a new patchelf, which it did: scylladb/scylladb@07c5edcc30145277e803fec75472faf030b97d97.
If upstream patchelf fixes the regression I'll use it again, but it's not a burning problem for me.