Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 923430 - dev-dotnet/dotnet-sdk-bin: sys-devel/llvm's llvm-strip causes segfault with dev-util/patchelf hack
Summary: dev-dotnet/dotnet-sdk-bin: sys-devel/llvm's llvm-strip causes segfault with d...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: dotnet project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-31 18:53 UTC by Violet Purcell
Modified: 2024-03-18 09:24 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Violet Purcell 2024-01-31 18:53:43 UTC
After the musl patchelf hack was applied, llvm-strip started creating dotnet binaries that segfault whenever ran after stripping. This is clearly most likely a bug with llvm-strip.
Comment 1 James Le Cuirot gentoo-dev 2024-01-31 23:38:50 UTC
How odd. I'm finding it hard to see how these things could be related, but I must confess that I don't know exactly how stripping works. Knowing what patchelf is like, I wouldn't be so quick to blame LLVM. Does it happen with GNU's strip? What if you do this with glibc, even though it's not really necessary?
Comment 2 Maciej Barć gentoo-dev 2024-02-01 09:33:39 UTC
Musl chroot:
I saw that only one exe was being corrupted - "/opt/.../dotnet";

Bad:

> ldd "/opt/dotnet-sdk-bin-8.0/dotnet"

All fine:

> qlist dotnet-sdk-bin | grep '.so$' | xargs -n 1 --verbose ldd 

My further investigation:
musl + patchelf + gnu-strip => ok
musl + patchelf + llvm-strip => bad

glibc + patchelf + gnu-strip => ok

> -> ldd /opt/dotnet-sdk-bin-8.0/dotnet 
>         linux-vdso.so.1 (0x00007ffd4078c000)
>         libc.so.6 => /lib64/libc.so.6 (0x00007f002c8e3000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f002c8de000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f002c8d9000)
>         libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6 (0x00007f002c600000)
>         libm.so.6 => /lib64/libm.so.6 (0x00007f002c523000)
>         libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f002c8b4000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f002caff000)

glibc + patchelf + llvm-strip => bad

> -> /opt/dotnet-sdk-bin-8.0/dotnet 
> Naruszenie ochrony pamięci

For glibc I had to change libc.so to libc.so.6 in the patchelf call.

I think 'dotnet' is an executable not generated by any C/C++ compiler that's why its's behaving funny.

BTW, the strip call is:

> llvm-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version
Comment 3 Larry the Git Cow gentoo-dev 2024-02-01 10:10:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8947d11000a15ab7d438b5ad5c44dc4747129c4

commit c8947d11000a15ab7d438b5ad5c44dc4747129c4
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-02-01 09:36:36 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-02-01 10:10:13 +0000

    dev-dotnet/dotnet-sdk-bin: do not strip the dotnet binary
    
    Closes: https://bugs.gentoo.org/923430
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 ...net-sdk-bin-6.0.417-r2.ebuild => dotnet-sdk-bin-6.0.417-r3.ebuild} | 4 ++++
 ...net-sdk-bin-7.0.404-r2.ebuild => dotnet-sdk-bin-7.0.404-r3.ebuild} | 4 ++++
 ...net-sdk-bin-8.0.100-r2.ebuild => dotnet-sdk-bin-8.0.100-r3.ebuild} | 4 ++++
 ...net-sdk-bin-8.0.101-r1.ebuild => dotnet-sdk-bin-8.0.101-r2.ebuild} | 4 ++++
 4 files changed, 16 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=def2732bb6bee66f4c09527fe8b1e41dea2de963

commit def2732bb6bee66f4c09527fe8b1e41dea2de963
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-02-01 09:37:56 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-02-01 10:10:13 +0000

    dev-dotnet/dotnet-sdk: do not strip the dotnet binary
    
    Bug: https://bugs.gentoo.org/923430
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 .../{dotnet-sdk-8.0.100-r1.ebuild => dotnet-sdk-8.0.100-r2.ebuild}    | 4 ++++
 1 file changed, 4 insertions(+)
Comment 4 Maciej Barć gentoo-dev 2024-02-01 13:04:07 UTC
(In reply to Maciej Barć from comment #2)

> All fine:
> 
> > qlist dotnet-sdk-bin | grep '.so$' | xargs -n 1 --verbose ldd 

Wrong. I went to re-check and emerge dotnet pkgs and all of the binaries-to-strip are broken.
Have to restrict strip on those packages.
Comment 5 Larry the Git Cow gentoo-dev 2024-02-01 13:22:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dae019c3533b10fc0b84b4772367a668adcf01ae

commit dae019c3533b10fc0b84b4772367a668adcf01ae
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-02-01 13:17:04 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-02-01 13:22:30 +0000

    dev-dotnet/dotnet-sdk: do not strip any binaries
    
    Bug: https://bugs.gentoo.org/923430
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 dev-dotnet/dotnet-sdk/dotnet-sdk-8.0.100-r2.ebuild | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa2a28c1618b04e5d1cde61f3fe7ddc8328fe5bd

commit aa2a28c1618b04e5d1cde61f3fe7ddc8328fe5bd
Author:     Maciej Barć <xgqt@gentoo.org>
AuthorDate: 2024-02-01 13:14:00 +0000
Commit:     Maciej Barć <xgqt@gentoo.org>
CommitDate: 2024-02-01 13:22:30 +0000

    dev-dotnet/dotnet-sdk-bin: do not strip any binaries
    
    Bug: https://bugs.gentoo.org/923430
    Signed-off-by: Maciej Barć <xgqt@gentoo.org>

 ...dk-bin-6.0.417-r3.ebuild => dotnet-sdk-bin-6.0.417-r4.ebuild} | 9 ++++-----
 ...dk-bin-7.0.404-r3.ebuild => dotnet-sdk-bin-7.0.404-r4.ebuild} | 9 ++++-----
 ...dk-bin-8.0.100-r3.ebuild => dotnet-sdk-bin-8.0.100-r4.ebuild} | 9 ++++-----
 ...dk-bin-8.0.101-r2.ebuild => dotnet-sdk-bin-8.0.101-r3.ebuild} | 9 ++++-----
 4 files changed, 16 insertions(+), 20 deletions(-)