Skip to content

segfault following assert fail at patchelf.cc:556 #583

Open

Description

@jimav

patchelf segfauilts after printing an assertion error message, when applied a particular file, which I will attach. It seems to occur when --no-default-lib is used with both -set-interpreter and --set-rpath arguments of a certain minimum length.

Steps to reproduce

Here is a cut-down test which reproduces on my system (if it doesn't repro for you, please try making the /aaaa... and /bbb... much longer). /tmp/testprog is the file I will attach:

$ /tmp/patchelf/src/patchelf --no-default-lib --set-interpreter /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --set-rpath /bbbbbbbbbbbbb /tmp/testprog
patchelf: patchelf.cc:556: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Versym, Elf_Verdef, Elf_Verdaux, Elf_Verneed, Elf_Vernaux, Elf_Rel, Elf_Rela, ElfClass>::shiftFile(unsigned int, size_t, size_t) [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; Elf_Versym = short unsigned int; Elf_Verdef = Elf64_Verdef; Elf_Verdaux = Elf64_Verdaux; Elf_Verneed = Elf64_Verneed; Elf_Vernaux = Elf64_Vernaux; Elf_Rel = Elf64_Rel; Elf_Rela = Elf64_Rela; unsigned int ElfClass = 64; size_t = long unsigned int]: Assertion `splitIndex != -1' failed.
Aborted (core dumped)

Here is a gdb backtrace:

__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
warning: 44	./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff784526e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff78288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff782881b in __assert_fail_base (fmt=0x7ffff79d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55555558a144 "splitIndex != -1", file=file@entry=0x555555589b99 "patchelf.cc", line=line@entry=556, 
    function=function@entry=0x555555587e60 "void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Versym, Elf_Verdef, Elf_Verdaux, Elf_Verneed, Elf_Vernaux, Elf_Rel, Elf_Rela, ElfClass>::shiftFile(unsigned int, siz"...) at ./assert/assert.c:94
#6  0x00007ffff783b507 in __assert_fail (assertion=0x55555558a144 "splitIndex != -1", file=0x555555589b99 "patchelf.cc", line=556, 
    function=0x555555587e60 "void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Versym, Elf_Verdef, Elf_Verdaux, Elf_Verneed, Elf_Vernaux, Elf_Rel, Elf_Rela, ElfClass>::shiftFile(unsigned int, siz"...) at ./assert/assert.c:103
#7  0x000055555556d0ec in ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64u>::shiftFile (this=this@entry=0x7fffffffd320, extraPages=extraPages@entry=2, 
    startOffset=startOffset@entry=6672, extraBytes=extraBytes@entry=568) at patchelf.cc:556
#8  0x0000555555582675 in ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64u>::rewriteSectionsExecutable (this=this@entry=0x7fffffffd320) at patchelf.cc:1078
#9  0x00005555555828f9 in ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64u>::rewriteSections (this=this@entry=0x7fffffffd320, force=force@entry=false)
    at patchelf.cc:1198
#10 0x0000555555584f82 in ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64u>::noDefaultLib (this=this@entry=0x7fffffffd320) at patchelf.cc:2022
#11 0x000055555555c804 in patchElf2<ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64> > (fileName="/tmp/testprog", 
    fileContents=std::shared_ptr<std::vector<unsigned char, std::allocator<unsigned char> >> (use count 3, weak count 0) = {...}, elfFile=...)
    at patchelf.cc:2493
#12 patchElf () at patchelf.cc:2522
#13 mainWrapped (argc=<optimized out>, argv=<optimized out>) at patchelf.cc:2746
#14 0x000055555555850a in main (argc=<optimized out>, argv=<optimized out>) at patchelf.cc:2759

Build Version

I compiled patchelf from git source current master, 739a486, using gcc 13.3.0 on Ubuntu 24.04.1 LTS.

The compiled patchelf says it is version 0.18.0

The Test File

This is a copy of /usr/bin/x86_64-linux-gnu-cpp-13 i.e. gcc C Preprocessor executable (which I'm trying to patch to work on another server where I don't have root access to properly install anything...)

[Grumble... github would not let me attach the executable directly; so I put it in a tarball]

testprog.tar.gz

Activity

  1. mjklbhvg commented on Mar 19, 2025

    @mjklbhvg

    I encountered a similar bug to this, also hitting the assertions in shiftFile. As I understand it, these asserts make sure that the "shifted" pages are covered by exactly one LOAD segment.
    What is odd to me is, that in patchelf.cc:566 the size of the extra LOAD segment is calculated using the extraBytes instead of the "real" shift amount. It looks like this creates a gap that is not covered by any load segment, because extraBytes <= shift.
    Hitting this gap in a later shiftFile call will cause this crash.

    This patch seems to fix this particular issue:

    diff --git a/src/patchelf.cc b/src/patchelf.cc
    index c8fb56a..9867147 100644
    --- a/src/patchelf.cc
    +++ b/src/patchelf.cc
    @@ -563,7 +563,7 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, size_t start
         wri(phdr.p_offset, phdrs.at(splitIndex).p_offset - splitShift - shift);
         wri(phdr.p_paddr, phdrs.at(splitIndex).p_paddr - splitShift - shift);
         wri(phdr.p_vaddr, phdrs.at(splitIndex).p_vaddr - splitShift - shift);
    -    wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + extraBytes));
    +    wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + shift));
         wri(phdr.p_flags, PF_R | PF_W);
         wri(phdr.p_align, getPageSize());
     }
    @@ -1083,22 +1083,6 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsExecutable()
    
         Elf_Off curOff = sizeof(Elf_Ehdr) + phdrs.size() * sizeof(Elf_Phdr);
    
    -    /* Ensure PHDR is covered by a LOAD segment.
    -
    -       Because PHDR is supposed to have been covered by such section before, in
    -       here we assume that we don't have to create any new section, but rather
    -       extend the existing one. */
    -    for (auto& phdr : phdrs)
    -        if (rdi(phdr.p_type) == PT_LOAD &&
    -            rdi(phdr.p_offset) <= curOff &&
    -            rdi(phdr.p_offset) + rdi(phdr.p_filesz) > curOff &&
    -            rdi(phdr.p_filesz) < neededSpace)
    -        {
    -            wri(phdr.p_filesz, neededSpace);
    -            wri(phdr.p_memsz, neededSpace);
    -            break;
    -        }
    -
         /* Clear out the free space. */
         debug("clearing first %d bytes\n", startOffset - curOff);
         memset(fileContents->data() + curOff, 0, startOffset - curOff);
    

    I do not understand patchelf well enough to judge if this is a reasonable fix though.
    This also removes the only usage of the extraBytes argument in shiftFile.
    I removed the "Ensure PHDR is covered by LOAD" code because it created overlapping LOAD segments
    with the change in shiftFile.

    To at least somewhat test this patch I used the following "fuzzing" script using the test binary from this
    issue (sorry for using fish):

    #!/usr/bin/fish
    
    if not test -f testprog
        wget https://github.com/user-attachments/files/18447000/testprog.tar.gz
        tar -xvf testprog.tar.gz
    end
    cp testprog /tmp/testprog_backup
    while true
        cp /tmp/testprog_backup /tmp/testprog
        set cmdline "./src/patchelf "
        for i in $(seq 10)
            set -a cmdline (random choice --set-interpreter --set-soname --add-rpath --add-needed)
            set -a cmdline (string repeat (random 1 10000) A)
        end
    
        set -a cmdline /tmp/testprog
        if not eval $cmdline
            echo $cmdline > crash.sh
            echo FOUND CRASH `sh crash.sh`
            break
        else
            echo OK
        end
    end
    
  2. EdwarDu commented on Jul 16, 2025

    @EdwarDu

    I encountered a similar bug to this, also hitting the assertions in shiftFile. As I understand it, these asserts make sure that the "shifted" pages are covered by exactly one LOAD segment. What is odd to me is, that in patchelf.cc:566 the size of the extra LOAD segment is calculated using the extraBytes instead of the "real" shift amount. It looks like this creates a gap that is not covered by any load segment, because extraBytes <= shift. Hitting this gap in a later shiftFile call will cause this crash.

    This patch seems to fix this particular issue:

    diff --git a/src/patchelf.cc b/src/patchelf.cc
    index c8fb56a..9867147 100644
    --- a/src/patchelf.cc
    +++ b/src/patchelf.cc
    @@ -563,7 +563,7 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, size_t start
         wri(phdr.p_offset, phdrs.at(splitIndex).p_offset - splitShift - shift);
         wri(phdr.p_paddr, phdrs.at(splitIndex).p_paddr - splitShift - shift);
         wri(phdr.p_vaddr, phdrs.at(splitIndex).p_vaddr - splitShift - shift);
    -    wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + extraBytes));
    +    wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + shift));
         wri(phdr.p_flags, PF_R | PF_W);
         wri(phdr.p_align, getPageSize());
     }
    @@ -1083,22 +1083,6 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsExecutable()
    
         Elf_Off curOff = sizeof(Elf_Ehdr) + phdrs.size() * sizeof(Elf_Phdr);
    
    -    /* Ensure PHDR is covered by a LOAD segment.
    -
    -       Because PHDR is supposed to have been covered by such section before, in
    -       here we assume that we don't have to create any new section, but rather
    -       extend the existing one. */
    -    for (auto& phdr : phdrs)
    -        if (rdi(phdr.p_type) == PT_LOAD &&
    -            rdi(phdr.p_offset) <= curOff &&
    -            rdi(phdr.p_offset) + rdi(phdr.p_filesz) > curOff &&
    -            rdi(phdr.p_filesz) < neededSpace)
    -        {
    -            wri(phdr.p_filesz, neededSpace);
    -            wri(phdr.p_memsz, neededSpace);
    -            break;
    -        }
    -
         /* Clear out the free space. */
         debug("clearing first %d bytes\n", startOffset - curOff);
         memset(fileContents->data() + curOff, 0, startOffset - curOff);
    

    I do not understand patchelf well enough to judge if this is a reasonable fix though. This also removes the only usage of the extraBytes argument in shiftFile. I removed the "Ensure PHDR is covered by LOAD" code because it created overlapping LOAD segments with the change in shiftFile.

    To at least somewhat test this patch I used the following "fuzzing" script using the test binary from this issue (sorry for using fish):

    #!/usr/bin/fish
    
    if not test -f testprog
        wget https://github.com/user-attachments/files/18447000/testprog.tar.gz
        tar -xvf testprog.tar.gz
    end
    cp testprog /tmp/testprog_backup
    while true
        cp /tmp/testprog_backup /tmp/testprog
        set cmdline "./src/patchelf "
        for i in $(seq 10)
            set -a cmdline (random choice --set-interpreter --set-soname --add-rpath --add-needed)
            set -a cmdline (string repeat (random 1 10000) A)
        end
    
        set -a cmdline /tmp/testprog
        if not eval $cmdline
            echo $cmdline > crash.sh
            echo FOUND CRASH `sh crash.sh`
            break
        else
            echo OK
        end
    end
    

    I'm facing a similar issue, where growing RPATH size causing exec SEGV when directly launched (also in gdb), but can be executed by invoking interpreter + exec.
    #585

    Tried your patch, now it works, thank you very much.

  3. mjklbhvg commented on Aug 25, 2026

    @mjklbhvg

    Because of the bugs in patchelf I have decided to make my own version with a stronger focus on standard compliance and correctness that attempts to keep unnecessary changes of the original file to a minimum.
    See here: https://codeberg.org/H4nsen/patchelf2026 if you are desperate ;)

  4. magneticflux- commented on Oct 17, 2026

    @magneticflux-

    I just ran into this same assertion fail when patching cuda12.9-cuda_nvcc-12.9.86 from NixOS/nixpkgs@7b95b92. My build chain is ffmpeg-full-9.0.2 -> whisper-cpp-1.9.5 -> llama-cpp-0.6.0 -> cuda12.9-cuda_nvcc-12.9.86.

    This command errors when running autoFixElfFiles on bin/cudafe++, bin/.nvcc-wrapped, or nvvm/bin/cicc (random filesystem iteration order).

    NIXPKGS_ALLOW_UNFREE=1 nix build --impure nixpkgs#cudaPackages_12_9.cuda_nvcc
    Build log for nixpkgs#cudaPackages_12_9.cuda_nvcc
    got build log for '/nix/store/75jzrcn149zqv3ap1af9svl9hxzgmhr2-cuda12.9-cuda_nvcc-12.9.86.drv' from 'daemon'
    structuredAttrs is enabled
    source: sourcing buildRedistHook.bash (hostOffset=-1) (targetOffset=0)
    buildRedistHookRegistration: added unpackCudaLibSubdir to postUnpackHooks
    buildRedistHookRegistration: added unpackCudaPkgConfigDirs to postUnpackHooks
    buildRedistHookRegistration: added patchCudaPkgConfig to prePatchHooks
    buildRedistHookRegistration: added checkCudaNonEmptyOutputs to postInstallCheckHooks
    buildRedistHookRegistration: added fixupCudaPropagatedBuildOutputsToOut to postFixupHooks
    buildRedistHookRegistration: added checkCudaHasStubsIffIncludeRemoveStubsFromRunpathHook to postFixupHooks
    Sourcing auto-add-driver-runpath-hook
    Using autoAddDriverRunpath
    Sourcing fix-elf-files.sh
    Sourcing mark-for-cudatoolkit-root-hook
    Running phase: unpackPhase
    @nix {"action":"setPhase","phase":"unpackPhase"}
    unpacking source archive /nix/store/1m2f4x6wri3iqfr3y7m9disidvjwlzz7-cuda_nvcc-12.9.86-source
    source root is cuda_nvcc-12.9.86-source
    Running phase: patchPhase
    @nix {"action":"setPhase","phase":"patchPhase"}
    Running phase: updateAutotoolsGnuConfigScriptsPhase
    @nix {"action":"setPhase","phase":"updateAutotoolsGnuConfigScriptsPhase"}
    Running phase: configurePhase
    @nix {"action":"setPhase","phase":"configurePhase"}
    no configure script, doing nothing
    Running phase: installPhase
    @nix {"action":"setPhase","phase":"installPhase"}
    runPhase: moving tree to output out
    postInstall: moving /build/cuda_nvcc-12.9.86-source/nvvm to /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86 and renaming lib64 to lib
    renamed '/nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/lib64' -> '/nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/lib'
    postInstall: removing $(_TARGET_SIZE_) from nvcc.profile
    postInstall: patching nvcc.profile to use the correct include paths
    postInstall: patching nvcc.profile to use the correct NVVM paths
    postInstall: adding /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm to nvcc.profile
    postInstall: setting compiler-bindir to backendStdenv.cc in nvcc.profile
    postInstall: wrapping nvcc to add backendStdenv.cc to its PATH
    postInstall: Patching math_functions.h signatures to match glibc's ones
    postInstall: Patching math_functions.hpp signatures to match glibc's ones
    postInstall: Patching host_defines.h to skip __noinline__ macro under clang
    Running phase: fixupPhase
    @nix {"action":"setPhase","phase":"fixupPhase"}
    shrinking RPATHs of ELF executables and libraries in /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/lib/libnvvm.so.4.0.0
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/bin/cicc
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/cudafe++
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/ptxas
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/.nvcc-wrapped
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvlink
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/fatbinary
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/bin2c
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/__nvcc_device_query
    shrinking /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvcc
    checking for references to /build/ in /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86...
    patching script interpreter paths in /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86
    stripping (with command strip and flags -S -p) in /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/lib /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin
    automatically fixing dependencies for ELF files
    {'add_existing': True,
     'append_rpaths': [PosixPath('$ORIGIN')],
     'extra_args': [],
     'ignore_missing': [],
     'keep_libc': False,
     'libs': [PosixPath('/nix/store/7a2cjhcgzyym5zaz6m4fksw47qvm150w-gcc-16.2.0-lib/lib'),
              PosixPath('/nix/store/h4g9r791fa9dc0fsa3csw84p8yky3krw-setup-cuda-hook/lib')],
     'paths': [PosixPath('/nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86')],
     'preserve_origin': False,
     'recursive': True,
     'relativize_rpath': False,
     'runtime_dependencies': [],
     'structured_logs': False}
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/cudafe++
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/cudafe++
        libgcc_s.so.1 -> found: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib
    setting RPATH to: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib:$ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/ptxas
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/ptxas
    setting RPATH to: $ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/.nvcc-wrapped
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/.nvcc-wrapped
        libgcc_s.so.1 -> found: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib
    setting RPATH to: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib:$ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvlink
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvlink
        libgcc_s.so.1 -> found: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib
    setting RPATH to: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib:$ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/fatbinary
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/fatbinary
        libgcc_s.so.1 -> found: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib
    setting RPATH to: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib:$ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/bin2c
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/bin2c
    setting RPATH to: $ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/__nvcc_device_query
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/__nvcc_device_query
        libstdc++.so.6 -> found: /nix/store/7a2cjhcgzyym5zaz6m4fksw47qvm150w-gcc-16.2.0-lib/lib
        libgcc_s.so.1 -> found: /nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib
    setting RPATH to: /nix/store/7a2cjhcgzyym5zaz6m4fksw47qvm150w-gcc-16.2.0-lib/lib:/nix/store/3sj8msrsym648f35mk3gb3pp385hhk8r-gcc-16.2.0-libgcc/lib:$ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvcc
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/bin/nvcc
    setting RPATH to: $ORIGIN
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/lib/libnvvm.so.4.0.0
    setting RPATH to: $ORIGIN
    setting interpreter of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/bin/cicc
    searching for dependencies of /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/bin/cicc
    setting RPATH to: $ORIGIN
    auto-patchelf: 0 dependencies could not be satisfied
    autoFixElfFiles: using addDriverRunpath to fix /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/lib/libnvvm.so.4.0.0
    autoFixElfFiles: using addDriverRunpath to fix /nix/store/0s1rkd7jxbhf2zr61hygh9xn72a71j6w-cuda12.9-cuda_nvcc-12.9.86/nvvm/bin/cicc
    patchelf: patchelf.cc:547: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Nhdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Versym, Elf_Verdef, Elf_Verdaux, Elf_Verneed, Elf_Vernaux, Elf_Rel, Elf_Rela, ElfClass>::shiftFile(unsigned int, size_t, size_t) [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Nhdr = Elf64_Nhdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym; Elf_Versym = short unsigned int; Elf_Verdef = Elf64_Verdef; Elf_Verdaux = Elf64_Verdaux; Elf_Verneed = Elf64_Verneed; Elf_Vernaux = Elf64_Vernaux; Elf_Rel = Elf64_Rel; Elf_Rela = Elf64_Rela; unsigned int ElfClass = 64; size_t = long unsigned int]: Assertion `splitIndex == -1' failed.
    /nix/store/c9fggk6arh8c1x8fbama99crqng8wcmx-add-driver-runpath-hook/nix-support/setup-hook: line 23:   265 Aborted                    (core dumped) patchelf --set-rpath "/run/opengl-driver/lib:$origRpath" ${forceRpath:+--force-rpath} "$file"
    

    On my hardware, this is reproducible 100% of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions