Summary: | app-misc/pax-utils: scanelf symbol search fails with non-stripped binaries | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sam James <sam> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | arsen, kacper.slominski72, matthew |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://github.com/gentoo/pax-utils/pull/9 https://bugs.gentoo.org/show_bug.cgi?id=550482 https://issuetracker.google.com/issues/300314892 https://bugs.gentoo.org/show_bug.cgi?id=793770 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 549092 |
Description
Sam James
2022-05-26 02:58:14 UTC
We actually forgot to increment the version number. This is 1.3.4: $ scanelf --version pax-utils-v1.3.3: scanelf written for Gentoo by <solar and vapier @ gentoo.org> Seems to be down to symbol versioning, you have two @s in your regex so it doesn't match. Unsure why we see the symbol versions in scanelf_match_symname on a binary built on an x86 system and not on an amd64 system building with -m32. $ file dash* dash: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, not stripped dash-stripped: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, stripped $ scanelf -F '%s %p' -qyRgs '-^(aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|lio_listio|alphasort|getdirentries|readdir|readdir_r|scandir|scandirat|versionsort|creat|fallocate|fopen|fopenat|freopen|open|openat|posix_fadvise|posix_fallocate|__open|__open_2|__openat_2|ftw|nftw|glob|globfree|fgetpos|fopen|freopen|fseeko|fsetpos|ftello|tmpfile|mkostemp|mkostemps|mkstemp|mkstemps|mmap|getrlimit|prlimit|setrlimit|sendfile|fstat|fstatat|lstat|stat|__fxstat|__fxstatat|__lxstat|__xstat|fstatfs|statvfs|fstatvfs|lockf|lseek|ftruncate|pread|preadv|pwrite|pwritev|truncate|__pread_chk)(@.*)?$' dash* getrlimit@GLIBC_2.2,setrlimit@GLIBC_2.2 dash getrlimit,setrlimit dash-stripped AFAICT, the difference is whether scanelf peeks into symtab or not. Smaller reproducer that works (for me :p) when compiled on x86_64: $ cat test.c #include <stdio.h> int main() { puts("Hello!"); } $ gcc test.c -o test $ scanelf -F '%s %p' -qyRgs '-^(puts)(@@.*)?$' test $ strip test $ scanelf -F '%s %p' -qyRgs '-^(puts)(@@.*)?$' test puts test $ Seems like it is what Arsen mentioned, as the "strip" gets rid of .symtab (and leaves .dynsym behind) according to "readelf -s". Looking a bit further into this, AFAICS we need to look into both .dynsym and .symtab in places that call "scanelf_file_get_symtabs", since .symtab contains the local symbols, and the versioned external symbols, while .dynsym contains unversioned external symbols (with the versions stored in .gnu.version). |