GNU bug report logs -
#38055
patchelf: Assertion failed when setting interpreter
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38055 in the body.
You can then email your comments to 38055 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Mon, 04 Nov 2019 04:58:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ivan Vilata i Balaguer <ivan <at> selidor.net>
:
New bug report received and forwarded. Copy sent to
bug-guix <at> gnu.org
.
(Mon, 04 Nov 2019 04:58:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi, I'm using patchelf 0.8 from Guix commit 7f81cce3 on Debian Sid. When
trying to patch the `go` binary from
<https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz>, I get the following
error:
ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --print-interpreter $SHELL
/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/ld-linux-x86-64.so.2
ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --set-interpreter $(patchelf --print-interpreter $SHELL) /tmp/tmps2Cv6w/golang/bin/go
patchelf: patchelf.cc:701: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::rewriteSectionsExecutable() \
[with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; \
Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym]: Assertion `(off_t) rdi(hdr->e_shoff) >= startOffset' failed.
Aborted
(I know Go is packed for Guix, my need arises from trying to build an
unrelated project which relies on binary Go for its build process.)
It may be the problem described here regarding Go-produced binaries:
<https://github.com/NixOS/patchelf/issues/66>. It seems to be fixed in
patchelf 0.10, and indeed trying the same operation with patchelf 0.10 from
Debian does succeed to patch the binary.
As an aside, I tried to build `--with-source` for 0.10 and it succeeds to
compile, but tests fail to pass.
Thank you very much!
--
Ivan Vilata i Balaguer -- https://elvil.net/
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Tue, 05 Nov 2019 14:13:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 38055 <at> debbugs.gnu.org (full text, mbox):
Hi Ivan,
Ivan Vilata i Balaguer <ivan <at> selidor.net> skribis:
> Hi, I'm using patchelf 0.8 from Guix commit 7f81cce3 on Debian Sid. When
> trying to patch the `go` binary from
> <https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz>, I get the following
> error:
>
> ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --print-interpreter $SHELL
> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/ld-linux-x86-64.so.2
> ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --set-interpreter $(patchelf --print-interpreter $SHELL) /tmp/tmps2Cv6w/golang/bin/go
> patchelf: patchelf.cc:701: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::rewriteSectionsExecutable() \
> [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; \
> Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym]: Assertion `(off_t) rdi(hdr->e_shoff) >= startOffset' failed.
> Aborted
I think it’s a bug you should report upstream to the PatchELF
maintainers; it’s probably not Guix-specific.
Thanks,
Ludo’.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Tue, 05 Nov 2019 16:19:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 38055 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Tue, Nov 05, 2019 at 03:12:23PM +0100, Ludovic Courtès wrote:
> Hi Ivan,
>
> Ivan Vilata i Balaguer <ivan <at> selidor.net> skribis:
>
> > Hi, I'm using patchelf 0.8 from Guix commit 7f81cce3 on Debian Sid. When
> > trying to patch the `go` binary from
> > <https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz>, I get the following
> > error:
> >
> > ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --print-interpreter $SHELL
> > /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/ld-linux-x86-64.so.2
> > ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --set-interpreter $(patchelf --print-interpreter $SHELL) /tmp/tmps2Cv6w/golang/bin/go
> > patchelf: patchelf.cc:701: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::rewriteSectionsExecutable() \
> > [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; \
> > Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym]: Assertion `(off_t) rdi(hdr->e_shoff) >= startOffset' failed.
> > Aborted
>
> I think it’s a bug you should report upstream to the PatchELF
> maintainers; it’s probably not Guix-specific.
>
On the other hand, if I were the patchelf maintainers, I'd suggest
upgrading our package from 0.8 to a newer version.
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Wed, 06 Nov 2019 21:44:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 38055 <at> debbugs.gnu.org (full text, mbox):
Efraim Flashner (2019-11-05 18:18:22 +0200) wrote:
> On Tue, Nov 05, 2019 at 03:12:23PM +0100, Ludovic Courtès wrote:
> >
> > Ivan Vilata i Balaguer <ivan <at> selidor.net> skribis:
> >
> > > Hi, I'm using patchelf 0.8 from Guix commit 7f81cce3 on Debian Sid.
> > > When trying to patch the `go` binary from
> > > <https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz>, I get the
> > > following error:
> > >
> > > ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --print-interpreter $SHELL
> > > /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/ld-linux-x86-64.so.2
> > > ivan <at> sax /tmp/tmps2Cv6w [env]$ patchelf --set-interpreter $(patchelf --print-interpreter $SHELL) /tmp/tmps2Cv6w/golang/bin/go
> > > patchelf: patchelf.cc:701: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::rewriteSectionsExecutable() \
> > > [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; \
> > > Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym]: Assertion `(off_t) rdi(hdr->e_shoff) >= startOffset' failed.
> > > Aborted
> >
> > I think it’s a bug you should report upstream to the PatchELF
> > maintainers; it’s probably not Guix-specific.
>
> On the other hand, if I were the patchelf maintainers, I'd suggest
> upgrading our package from 0.8 to a newer version.
Yeah, as I mentioned in the original mail that particular problem does indeed
seem to be fixed in 0.10. However when I try to build that source with `guix
build patchelf --with-source=…`, tests fail.
If I run `guix environment -C --pure patchelf` then unpack and build the
source, the only test that actually fails is `no-rpath.sh`. If I run `sh -x
no-rpath.sh` I get this:
```
++ basename no-rpath.sh .sh
+ SCRATCH=scratch/no-rpath
+ rm -rf scratch/no-rpath
+ mkdir -p scratch/no-rpath
+ cp no-rpath scratch/no-rpath/
++ ../src/patchelf --print-rpath scratch/no-rpath/no-rpath
+ oldRPath=/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib
+ test -n /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib
+ exit 1
```
To succeed, the output of `…/patchelf --print-rpath …/no-rpath`
(i.e. `oldRPath`) should be empty. I'm not that familiar with Guix's GNU
build system, but is that at all possible under Guix? I mean, maybe the test
is pointless or must be altered in some Guix-specific way for the `no-rpath`
binary not to have an rpath.
Cheers,
--
Ivan Vilata i Balaguer -- https://elvil.net/
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Thu, 07 Nov 2019 20:56:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 38055 <at> debbugs.gnu.org (full text, mbox):
Bona nit!
Ivan Vilata i Balaguer <ivan <at> selidor.net> skribis:
> Yeah, as I mentioned in the original mail that particular problem does indeed
> seem to be fixed in 0.10. However when I try to build that source with `guix
> build patchelf --with-source=…`, tests fail.
>
> If I run `guix environment -C --pure patchelf` then unpack and build the
> source, the only test that actually fails is `no-rpath.sh`. If I run `sh -x
> no-rpath.sh` I get this:
>
> ```
> ++ basename no-rpath.sh .sh
> + SCRATCH=scratch/no-rpath
> + rm -rf scratch/no-rpath
> + mkdir -p scratch/no-rpath
> + cp no-rpath scratch/no-rpath/
> ++ ../src/patchelf --print-rpath scratch/no-rpath/no-rpath
> + oldRPath=/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib
> + test -n /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib
> + exit 1
> ```
>
> To succeed, the output of `…/patchelf --print-rpath …/no-rpath`
> (i.e. `oldRPath`) should be empty. I'm not that familiar with Guix's GNU
> build system, but is that at all possible under Guix? I mean, maybe the test
> is pointless or must be altered in some Guix-specific way for the `no-rpath`
> binary not to have an rpath.
Guix’ ‘gcc’ automatically adds RUNPATH entries to glibc/lib and
gcc:lib/lib:
--8<---------------cut here---------------start------------->8---
$ gcc -dumpspecs |grep -e -rpath
%{!mandroid|tno-android-ld:-L/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib %{!static:-rpath=/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib %{!static-libgcc:-rpath=/gnu/store/347y0zr1a9s2f5pkcncgi3gd0r33qq81-gcc-9.2.0-lib/lib -lgcc_s}} %{pthread:-lpthread} %{shared:-lc} %{!shared:%{profile:-lc_p}%{!profile:-lc}};:%{shared:-lc} %{!shared:%{profile:-lc_p}%{!profile:-lc}} %{!static: -ldl}}
--8<---------------cut here---------------end--------------->8---
The code that modifies GCC to do that is in (gnu packages gcc).
Thus, RUNPATH is never empty, and the test above is bound to fail.
Two possibilities: change the test to ensure that ‘--print-rpath’
returns precisely libc/lib:gcc/lib, or, if that turns out to be tricky,
skip the test (in both cases, add a comment linking to this discussion
for future reference.)
How does that sound?
Thank you!
Ludo’.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Sat, 09 Nov 2019 18:27:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 38055 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
guix-patches <at> gnu.org
Bcc:
Subject: Re: bug#38055: patchelf: Assertion failed when setting interpreter
Reply-To:
In-Reply-To: <87zhh7mmoo.fsf <at> gnu.org>
X-PGP-Key-ID: 0x41AAE7DCCA3D8351
X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc
X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
I put together a patch to bump patchelf to 0.10. 'guix refresh -l
patchelf' says there's 614 dependent packages, but 'git grep ,patchelf'
and 'git grep guix\ build\ rpath' it looks like there's julia and 613
haskell packages.
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[0001-gnu-patchelf-Update-to-0.10.patch (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Sun, 10 Nov 2019 14:15:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 38055 <at> debbugs.gnu.org (full text, mbox):
Hi,
Efraim Flashner <efraim <at> flashner.co.il> skribis:
> From 2db156170a24fea36aced781faf96c839a3b7d15 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim <at> flashner.co.il>
> Date: Sat, 9 Nov 2019 20:19:11 +0200
> Subject: [PATCH] gnu: patchelf: Update to 0.10.
>
> * gnu/packages/elf.scm (patchelf): Update to 0.10.
> [source]: Remove patches.
> [arguments]: Remove patch/rework-for-arm phase. Add phase to modify
> tests for our modified GCC package.
> [native-inputs]: Add gcc:lib.
> * gnu/packages/patches/patchelf-page-size.patch,
> * gnu/packages/patches/patchelf-rework-for-arm.patch: Remove files.
> * gnu/local.mk (dist_patch_DATA): Remove them.
[...]
> + (modify-phases %standard-phases
> + (add-after 'unpack 'fix-tests
> + ;; Our GCC code ensures that RUNPATH is never empty, it includes
> + ;; at least glibc/lib and gcc:lib/lib.
> + (lambda* (#:key inputs #:allow-other-keys)
> + (substitute* "tests/no-rpath.sh"
> + (("^if test.*") "")
> + (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib")
> + "/lib")))
Could you complement the above comment with something like: “Thus,
disable the test that checks for an empty RUNPATH.”, or whatever is
appropriate? That will clarify the intent because it’s not obvious what
the substitution is doing if you don’t have the file at hand. :-)
Otherwise LGTM, thanks for addressing this issue!
Ludo’.
Reply sent
to
Efraim Flashner <efraim <at> flashner.co.il>
:
You have taken responsibility.
(Mon, 11 Nov 2019 09:29:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Ivan Vilata i Balaguer <ivan <at> selidor.net>
:
bug acknowledged by developer.
(Mon, 11 Nov 2019 09:29:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 38055-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Some inline comments added. Patch pushed.
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Mon, 11 Nov 2019 15:12:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 38055-done <at> debbugs.gnu.org (full text, mbox):
Efraim Flashner (2019-11-11 11:27:30 +0200) wrote:
> Some inline comments added. Patch pushed.
Wow, thank you so much for taking care of this! I did prepare a patch on
Friday but I didn't have the time to send it, plus it pales in comparison to
Efraim's and it also had the `ipfs` binary segfault after patching. I'm still
attaching it in case you're curious (of course I don't expect any of it to get
merged `;)`).
I'll try to find a moment to test your patch and see if the `ipfs` binary
doesn't segfault, then report back.
Thanks again!
--
Ivan Vilata i Balaguer -- https://elvil.net/
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Mon, 11 Nov 2019 15:32:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 38055-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ivan Vilata i Balaguer (2019-11-11 10:10:10 -0500) wrote:
> […] I'm still attaching it in case you're curious (of course I don't expect
> any of it to get merged `;)`). […]
Forgot the attachment… `:P`
--
Ivan Vilata i Balaguer -- https://elvil.net/
[0001-gnu-patchelf-Update-to-0.10.patch (text/plain, attachment)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#38055
; Package
guix
.
(Tue, 12 Nov 2019 05:21:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 38055-done <at> debbugs.gnu.org (full text, mbox):
Ivan Vilata i Balaguer (2019-11-11 10:10:10 -0500) wrote:
> Efraim Flashner (2019-11-11 11:27:30 +0200) wrote:
>
> > Some inline comments added. Patch pushed.
>
> […] I'll try to find a moment to test your patch and see if the `ipfs`
> binary doesn't segfault, then report back. […]
I tried your patch, the following command in a pure container environment:
$ patchelf --set-interpreter "$(patchelf --print-interpreter /bin/sh)" /path/to/bin/go
does not trigger the assertion error (both `--set-interpreter` and
`--set-rpath` suffered from the same failure), and the resulting `go` binary
can be executed without issues.
Thank you very much for fixing this! `:)`
--
Ivan Vilata i Balaguer -- https://elvil.net/
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 10 Dec 2019 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 136 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.