| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Under glibc-2.33 sandox uses faccessat2 to stat symlinks.
Unfortunately libseccomp does not yet provide syscall definition
for faccessat2. Define it locally.
Reported-by: Cănărău Constantin
Bug: https://bugs.gentoo.org/768435
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
libseccomp does not yet provide faccessat2. I tested the commit
without seccomp enabled.
This reverts commit e2378b8c6bef5d94805444797e7fe35c07f54783.
Bug: https://bugs.gentoo.org/768435
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
| |
Under glibc-2.33 sandox uses faccessat2 to stat symlinks.
Reported-by: Cănărău Constantin
Bug: https://bugs.gentoo.org/768435
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
Add flag -U/--uuid to dump the object's UUID.
(This is in particular useful when comparing against TextAPI stubs,
.tbd files.)
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
|
|
|
| |
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
|
|
|
|
| |
Reported-by: Leah Neukirchen <leah@vuxu.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
| |
Closes: https://github.com/gentoo/pax-utils/pull/4
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
Avoid using 'strings' to extract libpaths.
Let's use hardcoded fallback values unconditionally
until we get more robust way to fetch default libpath.
Reported-by: Kent Fredric
Bug: https://bugs.gentoo.org/736601
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
musl-1.1.24 starting from dfc81828f7ab41da08f744c
"implement fstatat with SYS_statx, conditional on undersized kstat time"
changed fstatat() to use statx().
This caused scanelf to crash under seccomp sandbox.
The change whitelists 'statx' syscall.
Bug: https://bugs.gentoo.org/717300
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
| |
Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Put ldso interpreter library path at end of libpaths search.
It is supposed to be a final fallback path in case library
search was incomplete.
As a side effect, it currently mitigates the incorrect
libbfd being loaded for aarch64 standalone toolchain.
Bug: https://crbug.com/917193
Reviewed-on: https://crrev.com/c/1920643
Signed-off-by: Manoj Gupta <manojgupta@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Print out relocation type and explain addresses:
```
$ ./scanelf -T -v gdb
TYPE TEXTRELS FILE
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
gdb: (memory/data?) [r_offset=0x0] r_type=0 in (optimized out?) [closest_prev_sym=0x0]
```
Note: it's now more obvious that suspicious relocations are not real
and just zero-initialized leftovers of R_*_NONE type.
Bug: https://bugs.gentoo.org/713082
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
Fix crash when running in verbose mode on bad files:
$ ./scanelf -T -v gdb
The file is taken from bug #713082.
Bug: https://bugs.gentoo.org/713082
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
| |
This allows running testsuite as-is on prefix.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc-2.31 switched semop() libc implementation from semop() to semtimedop()
in https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=765cdd0bffd77960a
("sysvipc: Implement semop based on semtimedop")
This caused pax-utils to fail under fakeroot as:
```
$ fakeroot scanelf -yqRBF '#k%F' -k '.symtab' /bin/bash
.../usr/bin/fakeroot: line 178: 103268 Bad system call ...
Program terminated with signal SIGSYS, Bad system call.
33 ../sysdeps/unix/sysv/linux/semtimedop.c: No such file or directory.
(gdb) bt
(gdb)
```
The change whitelists 'semtimedop' syscall.
Reported-by: Patrick McLean
Bug: https://bugs.gentoo.org/709794
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Detected by gcc-10 as:
```
dumpelf.c: In function 'dump_shdr':
dumpelf.c:462:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
462 | printf("\t */\n"); \
| ^~~~~~~~~~~~~~~~~
```
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On amd64 and friends msgget() and similar syscalls are standalone syscalls.
On i386 and friends msgget() is a subcall of ipc() syscall.
This makes fakechroot break 'scanelf' as:
$ LANG=C fakeroot scanelf -t /bin/bash
/usr/bin/fakeroot: line 178: 6820 Bad system call (core dumped)
The change whitelists ipc() call which allows all sysv syscalls, namely:
- semop, semget, semctl, semtimedop
- msgsnd, msgrcv, msgget, msgctl
- shmat, shmdt, shmget, shmctl
Reported-and-fixed-by: Samuel Holland
Bug: https://bugs.gentoo.org/675378
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
os.errno interface is removed [1], thus should not be used. In fact, it
is not used in other places of lddtree.py, so fix this one too, because
it breaks --copy-to-tree on systems with Python 3.7.
[1] https://bugs.python.org/issue33666
Bug: https://bugs.gentoo.org/671522
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
| |
We rarely need to modify the memory from our input ELFs, so constify all
the buffers. We end up having to cast away the const in the "fix" paths
in scanelf (which is a bit ugly), but otherwise everything else works.
|
| |
|
|
|
|
|
| |
This makes the code a bit nicer to deal with. For portable targets,
we already include asprintf from gnulib.
|
|
|
|
| |
This helper funcs only read data, so mark elfobj as const.
|
|
|
|
| |
Mark internal pointers as const that we don't modify anywhere.
|
|
|
|
| |
Mark all possible pointers const since we don't modify anything.
|
| |
|
| |
|
|
|
|
|
| |
Use the -Werror=unknown-warning-option option if available so clang
will reject some of the extra -W flags we add ourselves.
|
|
|
|
|
| |
We need to also constify scanelf_file_get_symtabs due to cascading
const markings.
|
|
|
|
| |
Just house keeping -- all of these pointers are already used as const mem.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In bug #566118 scanelf failed to decode TEXTRELs on gcc binaries
where program headers have absolute addresses:
$ dumpelf ia64_bug_gcc/cc1plus
/* Dynamic tag #25 'DT_RELA' 0x2099518 */
{
.d_tag = 0x7 ,
.d_un = {
.d_val = 0x4000000000104B08 ,
.d_ptr = 0x4000000000104B08 ,
},
},
/* Section Header #8 '.rela.dyn' 0x20AA610 */
{
.sh_type = 4 , /* [SHT_RELA] */
.sh_addr = 0x4000000000104B08 ,
.sh_offset = 1067784 , /* (bytes) */
},
Before the change scanelf assumed DT_RELA.d_ptr is
a relative offset. This is not true in general case
but good-enough for DSOs as they have zero load address.
This change extends the check for executables.
To make addresses relative again we find load address
of first byte from program header with 'p_offset'.
/* Program Header #2 0xB0 */
{
.p_type = 1 , /* [PT_LOAD] */
.p_offset = 0 , /* (bytes into file) */
.p_vaddr = 0x4000000000000000 , /* (virtual addr at runtime) */
.p_paddr = 0x4000000000000000 , /* (physical addr at runtime) */
},
Bug: https://bugs.gentoo.org/566118
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
| |
Need gnulib modules stpcpy, euidaccess for Solaris 10, where euidaccess
uses eaccess when available, probably via LIB_EACCESS.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
|
|
|
| |
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit 2eb852129394f97dae89c0ff1f9f48637edcb0e9
slightly changed decoder and added unchecked
read from elf header:
```
switch (EGET(dpltrel->d_un.d_val)) { \
case DT_REL: \
rel = REL##B(elf->vdata + EGET(drel->d_un.d_val)); \
```
On ia64 'EGET(drel->d_un.d_val)' returns absolute address:
```
$ dumpelf bug/luatex
...
/* Dynamic tag #31 'DT_RELA' 0x97E310 */
{
.d_tag = 0x7 ,
.d_un = {
.d_val = 0x4000000000031C30 ,
.d_ptr = 0x4000000000031C30 ,
},
},
```
That causes 'scanelf' crash on binaries like 'luatex'.
This change restores check and loudly skips such sections:
scanelf: bug/luatex: DT_RELA is out of file range
Bug: https://bugs.gentoo.org/624356
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
|
| |
|
|
|
|
| |
This keeps the main func a bit cleaner.
|
|
|
|
| |
Fix up some lddtree logic at the same time so it's warning free.
|
| |
|
|
|
|
| |
Less likely to screw up the logic this way.
|
|
|
|
|
|
|
| |
Make sure we don't walk off the end of the ELF with a corrupt hash table.
URL: https://bugs.gentoo.org/608766
Reported-by: Agostino Sarubbo <ago@gentoo.org>
|
|
|
|
|
|
|
| |
Handle cases where the size fields would overflow the additions.
URL: https://bugs.gentoo.org/607898
Reported-by: Agostino Sarubbo <ago@gentoo.org>
|
|
|
|
|
| |
URL: https://bugs.gentoo.org/607896
Reported-by: Agostino Sarubbo <ago@gentoo.org>
|
|
|
|
|
| |
URL: https://bugs.gentoo.org/607894
Reported-by: Agostino Sarubbo <ago@gentoo.org>
|
| |
|
|
|
|
|
|
| |
The rpath/needed/soname strings are only listed in .dynstr, so trying
to locate them in .strtab fails. Which means using the lookup helper
breaks behavior on non-stripped files.
|
|
|
|
|
|
| |
We don't care about the .strtab-vs-.dynstr, but we do want to fall
back to tables that can only be found via dynamic tags and program
headers.
|