Skip to content

fix shared obj lookup in getLibraryDependencies()#35

Open
thefossguy wants to merge 1 commit intoZouuup:mainfrom
thefossguy:fix-shared-object-discovery
Open

fix shared obj lookup in getLibraryDependencies()#35
thefossguy wants to merge 1 commit intoZouuup:mainfrom
thefossguy:fix-shared-object-discovery

Conversation

@thefossguy
Copy link
Copy Markdown

Sometimes, the ld-linux shared object is presented as an absolute path, instead of the shared object name and the path where that shared object is found.

Something like this:

$ ldd /nix/store/s7cjsl5g5hdi4lfmb5qghghgni69ch1y-coreutils-full-9.7/bin/true
        linux-vdso.so.1 (0x0000ffffb47fc000)
        libcrypto.so.3 => /nix/store/ffdmy5fhjr6m1gkb8mycyf3swakvygd1-openssl-3.4.1/lib/libcrypto.so.3 (0x0000ffffb4240000)
        libacl.so.1 => /nix/store/ccy32hi8wvjj1im3dbjld658rpvl226n-acl-2.3.2/lib/libacl.so.1 (0x0000ffffb4210000)
        libattr.so.1 => /nix/store/3fqsrmsjdpfpy6dyxymbg6r01f9y39ln-attr-2.5.2/lib/libattr.so.1 (0x0000ffffb41e0000)
        libgmp.so.10 => /nix/store/xmdlv9xmhyiqip377326ph94k1ipndz2-gmp-with-cxx-6.3.0/lib/libgmp.so.10 (0x0000ffffb4140000)
        libc.so.6 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libc.so.6 (0x0000ffffb3f60000)
        /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/ld-linux-aarch64.so.1 (0x0000ffffb47c0000)
        libdl.so.2 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libdl.so.2 (0x0000ffffb3f30000)
        libpthread.so.0 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libpthread.so.0 (0x0000ffffb3f00000)

Here, because the line with ld-linux-aarch64.so.1 does not have the pattern =>, it gets excluded and the binary execution (with the --ldd flag) fails due to a permissions error.

Sometimes, the `ld-linux` shared object is presented as an absolute
path, instead of the shared object name and the path where that shared
object is found.

Something like this:
```
$ ldd /nix/store/s7cjsl5g5hdi4lfmb5qghghgni69ch1y-coreutils-full-9.7/bin/true
        linux-vdso.so.1 (0x0000ffffb47fc000)
        libcrypto.so.3 => /nix/store/ffdmy5fhjr6m1gkb8mycyf3swakvygd1-openssl-3.4.1/lib/libcrypto.so.3 (0x0000ffffb4240000)
        libacl.so.1 => /nix/store/ccy32hi8wvjj1im3dbjld658rpvl226n-acl-2.3.2/lib/libacl.so.1 (0x0000ffffb4210000)
        libattr.so.1 => /nix/store/3fqsrmsjdpfpy6dyxymbg6r01f9y39ln-attr-2.5.2/lib/libattr.so.1 (0x0000ffffb41e0000)
        libgmp.so.10 => /nix/store/xmdlv9xmhyiqip377326ph94k1ipndz2-gmp-with-cxx-6.3.0/lib/libgmp.so.10 (0x0000ffffb4140000)
        libc.so.6 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libc.so.6 (0x0000ffffb3f60000)
        /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/ld-linux-aarch64.so.1 (0x0000ffffb47c0000)
        libdl.so.2 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libdl.so.2 (0x0000ffffb3f30000)
        libpthread.so.0 => /nix/store/7kpxf47mzykkdn39lcnhj9z9ngpihamf-glibc-2.40-66/lib/libpthread.so.0 (0x0000ffffb3f00000)
```

Here, because the line with `ld-linux-aarch64.so.1` does not have the
pattern `=>`, it gets excluded and the binary execution (with the
`--ldd` flag) fails due to a permissions error.
@thefossguy
Copy link
Copy Markdown
Author

Closes #21.

@thefossguy
Copy link
Copy Markdown
Author

gentle ping

@thefossguy
Copy link
Copy Markdown
Author

@Zouuup ping

@Zouuup
Copy link
Copy Markdown
Owner

Zouuup commented Aug 25, 2025

I think I prefer #38 for this, thoughts?

@thefossguy
Copy link
Copy Markdown
Author

Wasn't aware of #38. Let me test it on my machines and I'll get back.

@Zouuup
Copy link
Copy Markdown
Owner

Zouuup commented Oct 1, 2025

@thefossguy are you happy with #38? should we close this one?

@thefossguy
Copy link
Copy Markdown
Author

@Zouuup There's still another problem of only absolute SO paths being whitelisted.
#38 (comment)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants