You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The difference between this executable and ones that don't break is that shiftFile is not called when processing this executable. shiftFile creates a writable PT_LOAD/segment for the moved sections to go into and PT_DYNAMIC pointing into that works fine but when shiftFile is not called, the PT_DYNAMIC header is just updated to point to near the beginning of the file without regard to which segment that gets mapped into (I guess you could contrive a situation where it was unmapped rather than mapped read only but ...).
I don't know what the fix would be. I guess a new PT_LOAD always needs to be created and in the non-shiftFiles case, any PT_LOAD covering that part of the file adjusted to no longer cover it?
I tried this with a fresh version of influxd and the same old version of patchelf, and didn't get the problem, so I suspect whatever changed was actually not a fix in patchelf. Possibly influxd (or go) doesn't happen to produce those slightly-strange executables anymore.
$ for i in result/bin/*; do echo -n $i "... " && $i && echo WORKS; done
result/bin/issue_146 ... result/bin/issue_146: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory
result/bin/issue_146.patchelf ... Segmentation fault (core dumped)
result/bin/issue_146.wrapped ... WORKS
I have just encountered an eerily similar bug, where patchelf 0.18.0 (built from source) appears to corrupt libxcb-image.so.0 under the latest Ubuntu Focal after a single call to --set-rpath. Following the change, ldd complains that the shared object file is not a dynamic executable
Activity
mwhudson commentedon Apr 10, 2018
The difference between this executable and ones that don't break is that shiftFile is not called when processing this executable. shiftFile creates a writable PT_LOAD/segment for the moved sections to go into and PT_DYNAMIC pointing into that works fine but when shiftFile is not called, the PT_DYNAMIC header is just updated to point to near the beginning of the file without regard to which segment that gets mapped into (I guess you could contrive a situation where it was unmapped rather than mapped read only but ...).
I don't know what the fix would be. I guess a new PT_LOAD always needs to be created and in the non-shiftFiles case, any PT_LOAD covering that part of the file adjusted to no longer cover it?
ezquat commentedon Aug 2, 2018
Probably duplicate: #152.
cmatsuoka commentedon Mar 31, 2019
This is also preventing go binaries to be used in classic Snap packages, which rely on rpath changes to work properly.
domenkozar commentedon Jun 9, 2020
Can't reproduce on master:
ezquat commentedon Jun 10, 2020
I tried this with a fresh version of influxd and the same old version of patchelf, and didn't get the problem, so I suspect whatever changed was actually not a fix in patchelf. Possibly influxd (or
go) doesn't happen to produce those slightly-strange executables anymore.Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
Reproducer for NixOS/patchelf#146
grahamc commentedon Sep 15, 2020
I see there is a reproducer from @limeytexan at https://github.com/limeytexan/NixOS-patchelf-issue-146. I've uploaded a .tar.gz of the source and the patchelf'd and unpatchelf'd build results for posterity.
Log:
NixOS-patchelf-issue-146-master.tar.gz
Both are at 6a888058bc833af8260b90223371d6b2e47ca4a6, and my host is at:
petrmanek commentedon Dec 14, 2023
Hi, has there been any evolution on this issue?
I have just encountered an eerily similar bug, where patchelf 0.18.0 (built from source) appears to corrupt
libxcb-image.so.0under the latest Ubuntu Focal after a single call to--set-rpath. Following the change, ldd complains that the shared object file isnot a dynamic executableAdd PF_W to PT_LOAD segment where the .dynamic section is placed
Add PF_W to PT_LOAD segment where the .dynamic section is placed
mr-cal commentedon Nov 6, 2026
As far as I can tell, this was fixed via aec02f6 in #651, which was released in 0.19.1.
[ABLD-525] Point Bazel-built FIPS Go binaries to the embedded OpenSSL (…