| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
ChangeLog
backends/ChangeLog
config/ChangeLog
lib/ChangeLog
libasm/ChangeLog
libcpu/ChangeLog
libdw/ChangeLog
libdwfl/ChangeLog
libdwfl/derelocate.c
libdwfl/linux-kernel-modules.c
libebl/ChangeLog
libelf/ChangeLog
src/ChangeLog
tests/ChangeLog
Change-Id: I3b7ced947c6498290aaae27443985b84531f0bcd
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
At least one test (dwfl-addr-sect) depends on the order of elf sections
with equal addresses. This is not guaranteed by the code. Compare also
by end address and section index to tell entries apart.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
| |
| |
| |
| |
| |
| |
| | |
We don't want to use it, even if it exists.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.
In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
__attribute__ is a GNU extension. If we want to link against the
libraries using a different compiler, it needs to be disabled. It was
already disabled in libdw.h, and this patch extends this to the other
headers. We move the defines to libelf.h as that is included in all
the others.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some compilers implicitly cast the result of uint_fast16_t *
uint_fast16_t to something signed and then complain about the
comparison to (unsigned) size_t.
Casting phnum to size_t is a good idea anyway as 16bit multiplication
can easily overflow and we are not checking for this.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
If shnum is 0, the many "shnum - 1" would result in an overflow. Check it
for 0, and only subtract once, rather than on every usage.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| | |
We only include them where we actually need them and only on linux.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
The bad fts not only needs to be included before config.h, but also
requires various special types without including sys/types.h.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On windows the resulting ino and dev entries are always 0, so the file
would always be discarded. We apply a heuristic instead: If the ctime,
mtime, mode and size of the two files are all equal then we consider
them to be the same. It's exceedingly unlikely to produce two different
files for which that holds by chance.
Change-Id: I491c95ab8b90fc3c1b786cceae242e142b5a491f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In general we need to use ';' as path separator and '\' and directory
separator on windows. The shell will automatically translate paths to
some extent, but we have to call "pwd -W" rather than plain "pwd" to
get something useful.
Change-Id: I1a117d219a2aa00c1f77ae7d3a1d92b9bae526db
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If O_BINARY is not defined, define it to 0, so that the change has no
effect then. Some systems have separate binary and text modes for files,
and we don't want the text mode to be used.
Change-Id: If7efb5bd448c2a1c7d1eb5dab276849b1b15a3ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
If we don't have it, we don't translate system error codes to strings in
dwfl_error.c.
Change-Id: I829616cfba787d778c3273f2042512739df91d81
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
mempcpy, memrchr, rawmemchr, and argp are provided by gnulib now. We
don't need to define them locally and we don't need to search for an
external libargp.
Change-Id: I131ca4bc2d77c597b99c296c28259a3600e5d1b5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
At least one test (dwfl-addr-sect) depends on the order of elf sections
with equal addresses. This is not guaranteed by the code. Compare also
by end address and name to tell entries apart.
Change-Id: I0e85e7b86a0489b6bc85f45f9a359c68a04f635a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some compilers implicitly cast the result of uint_fast16_t *
uint_fast16_t to something signed and then complain about the
comparison to (unsigned) size_t.
Casting phnum to size_t is a good idea anyway as 16bit multiplication
can easily overflow and we are not checking for this.
Change-Id: I073202d433d75b540ca042d15c364187a08fec6c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.
In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.
Change-Id: Ib78dd7e058ef8ac93cd379dcd14a2ffbc86c1988
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ia74c04e2590d2d918fb7d5227a106de789551843
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
If shnum is 0, the many "shnum - 1" would result in an overflow. Check it
for 0, and only subtract once, rather than on every usage.
Change-Id: I37a9e5d4e012a501d5ec98762ec0a435c743e25f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
__attribute__ is a GNU extension. If we want to link against the
libraries using a different compiler, it needs to be disabled. It was
already disabled in libdw.h, and this patch extends this to the other
headers. We move the defines to libelf.h as that is included in all
the others.
Change-Id: I6e22674641f19f5a8820e2c7c7ec46f2fd70a8af
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
We only include them where we actually need them and only on linux.
Change-Id: Ic3065ffab67ba1177f63204fb91a92c5f4336dbb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
|/
|
|
|
|
|
|
| |
The bad fts not only needs to be included before config.h, but also
requires various special types without including sys/types.h.
Change-Id: I31ac8d2aadcf7ffb3efb63583b2745991bfd6f90
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
ELF notes can have a zero sized name. In which case there is no data at
all (so also no zero terminator). Make sure to use the empty string for
such notes if the code does not otherwise explicitly check n_namesz.
https://sourceware.org/bugzilla/show_bug.cgi?id=21300
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
If it doesn't exist, provide a definition based on memcpy.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
This makes it easier to write a replacement for it on systems where
sysconf(3) doesn't exist.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=21001
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Older versions of glibc included an fts implementation that didn't have
Large File System support. We worked around that in linux-kernel-modules.c
by including it early before config.h and then redefining some symbols
to get the 64-bit versions. This is somewhat fragile and not necessary
with newer glibc. If possible we want the 64bit fts version always.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one
small buglet in elflint option procession. So it seems useful to enable
to make sure all swatch case fallthroughs are deliberate.
Add configure check to detect whether gcc support -Wimplicit-fallthrough
and enable it. Add fixes and explicit fallthrough comments where necessary.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.
Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When reading the phdrs from a core file segment fails we would try to read
them from the exec. This fallback path contained a faulty assert that the
requested size of the phdrs was still setup. But the core file reading
callback might have reset the d_size value to zero on error. So explicitly
set the number of bytes we want to read again instead of asserting the size.
https://bugzilla.redhat.com/show_bug.cgi?id=1365812
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
If we allocated the match results array ourselves, then free it when
we detect invalid DWARF and return an error.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Normally last_file is freed inside report(), but in the case of a bad
file mapping we don't call report.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For non-Linux GNU platforms (like kFreeBSD, Hurd), linux-pid-attach.c
had some stub functions that are not used or exported. Since gcc-6,
having these caused compiler errors due to -Wall -Werror:
linux-pid-attach.c:479:36: error: 'pid_thread_callbacks' defined but not used [-Werror=unused-const-variable=]
linux-pid-attach.c:474:1: error: 'pid_thread_detach' defined but not used [-Werror=unused-function]
linux-pid-attach.c:461:1: error: 'pid_detach' defined but not used [-Werror=unused-function]
linux-pid-attach.c:452:1: error: 'pid_set_initial_registers' defined but not used [-Werror=unused-function]
linux-pid-attach.c:441:1: error: 'pid_memory_read' defined but not used [-Werror=unused-function]
linux-pid-attach.c:420:1: error: 'pid_getthread' defined but not used [-Werror=unused-function]
linux-pid-attach.c:410:1: error: 'pid_next_thread' defined but not used [-Werror=unused-function]
This part of the source file is guarded by #ifndef __linux__
Signed-off-by: Steven Chamberlain <steven@pyro.eu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Elfutils, looking for kernel debuginfo file, tries to find it at
various places. If elfutils finds /boot/vmlinu*x* file, it checks
for debufginfo section. If debuginfo is not present, it saves it as
'main elf' and continue looking for debuginfo file having .debug
extension i.e. vmlinux-RELEASE.debug.
'Ubuntu on powerpc' installs kernel as /boot/vmlinux and installs
debuginfo without any extension as /usr/lib/debug/boot/vmlinux-RELEASE
and hence, elfutils is not able to find the debuginfo file.
Here is the launchpad bug for the same:
https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/1537125
This patch adds functionality to search for a kernel or debuginfo file
both with and without .debug extension.
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
We forgot to free last_file on error.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
new_unwound didn't check whether malloc was successful. Check that we
could allocate memory before use and return DWFL_E_NOMEM otherwise.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
For corrupted ELF files gelf_get calls might fail in which case it
is better to immediately return an error instead of using the NULL
result and crashing.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
For corrupted ELF files the gelf_update calls might fail in which case it
is better to immediately return an error message instead of (silently)
continuing.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Now that we always require zlib support we don't need to conditionally
build or compile code that depends on it.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
This makes usage of the libdwfl symbol functions work out of the box even
when some sections (string, symbol or xndx) are compressed. For ET_REL
files this makes relocations just work by making sure the target section
is decompressed first before relocations are applied.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
* Move nested function 'report' to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
| |
* Move nested functions 'fail', 'update_end', and 'more' to file scope.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
|
|
| |
* In libdwfl/link_map.c, nested functions check64, check32, are moved
to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Ebl backends can define an offset that must be applied to the value of
the "return address register" defined in the CFI ABI information.
This patch makes the unwinder to use that offset when reading the RA
CFI register.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
|
|
|
|
|
|
|
|
| |
The phdrs buffer could come from the core file or through the executable.
dwfl_link_map_report would leak the buffer if it came from the executable.
Track where the buffer came from and free appropriately.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Our argp helper would leak the core Elf and core file descriptor when
given by the user. Store both in the Dwfl as a new Dwfl_User_Core so
they get cleaned up by dwfl_end.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
* In dwfl_module_getdwarf.c, nested functions 'consider_shdr'
and 'translate_offs' are moved to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
* Move nested functions 'same_section', 'binding_value',
'try_sym_value', and 'search_table'.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libdwfl sets the Dwfl_Module Ebl for the eh_cfi and dwarf_cfi cache to
save a bit of memory. It also calls ebl_closebackend on the ebl to free
it. The Dwarf_CFI never frees the Ebl in the cache, even when it opened
one itself. This means that if only libdw calls are used to access the
Dwarf_CFI the Ebl might be leaked.
Always destroy the Dwarf_CFI cache Ebl in __libdw_destroy_frame_cache.
And in __libdwfl_module_free clear the Dwarf_CFI Ebl if it is the
Dwfl_Module Ebl before calling dwarf_cfi_end and dwarf_end.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
* libdwfl/gzip.c should now compile with clang.
All local variables used by nested functions are
passed in an unzip_state structure.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|