Re: [PATCH elfutils 1/2] [libdwfl] parse inode in /proc/pid/maps correctly

2019-01-29 Thread Mark Wielaard
On Fri, Jan 25, 2019 at 01:20:08PM -0800, Yonghong Song wrote: > The inode number in /proc/pid/maps is displayed as "unsigned long" > type. > > In one of our x64 system, we have inode number exceeding valid "long" > type range, which caused the following test failure: >FAIL: dwfl-bug-fd-leak >

Re: [PATCH elfutils 2/2] [tests] parse inode in /proc/pid/maps correctly in run-backtrace-data.sh

2019-01-29 Thread Mark Wielaard
On Fri, Jan 25, 2019 at 01:20:09PM -0800, Yonghong Song wrote: > The backtrace-data.c parsed the inode in /proc/pid/maps with > format "%*x". > This caused failure if inode is big. For example, > 7f269223d000-7f269226b000 r-xp 00:50 10224326387095067468 > /home/... I have a bit o

Re: [PATCHv1 0/2] specify a sysroot to search when examining a core file

2019-01-31 Thread Mark Wielaard
Hi Luke, (BTW. Note that HTML emails will get dropped, you should get a bounce from the mailinglist.) On Tue, 2019-01-29 at 19:46 +, Luke Diamand wrote: > Thanks for the comments on the other emails, I'll rework my patch to > incorporate them. > > I've got a small test case I've been using w

Re: [PATCH elfutils 2/2] [tests] parse inode in /proc/pid/maps correctly in run-backtrace-data.sh

2019-01-31 Thread Mark Wielaard
On Tue, Jan 29, 2019 at 09:23:39PM +, Yonghong Song wrote: > On 1/29/19 12:50 PM, Mark Wielaard wrote: > > On Fri, Jan 25, 2019 at 01:20:09PM -0800, Yonghong Song wrote: > >> The backtrace-data.c parsed the inode in /proc/pid/maps with > >> format "%*x".

Re: [PATCH elfutils] [tests] parse inode in /proc/pid/maps/correctly in run-backtrace-data.sh

2019-01-31 Thread Mark Wielaard
On Tue, Jan 29, 2019 at 01:33:03PM -0800, Yonghong Song wrote: > The backtrace-data.c parsed the inode in /proc/pid/maps with > format "%*x". > This caused failure if inode is big. For example, > 7f269223d000-7f269226b000 r-xp 00:50 10224326387095067468 > /home/... > > The error

Re: [PATCH elfutils 2/2] [tests] parse inode in /proc/pid/maps correctly in run-backtrace-data.sh

2019-01-31 Thread Mark Wielaard
On Thu, Jan 31, 2019 at 10:14:32PM +0100, Mark Wielaard wrote: > So your fix is correct. > But the testcase is also slightly wrong. > It really shouldn't check errno if the function didn't fail. > There is no guarantee that it will be zero. So, even though it found a bu

Re: [PATCH] configure: Add new --enable-install-elfh option.

2019-01-31 Thread Mark Wielaard
On Wed, Jan 30, 2019 at 09:54:53AM +, Ulf Hermann wrote: > > Yes, it should indeed. > > I used a slightly different solution though. > > It relies on the default include flags already including the srcdirs. > > Does that work for your use case too? (See revised patch attached.) > > I'm not an

Re: unknown error after dwarf_cfi_addrframe()

2019-02-11 Thread Mark Wielaard
On Tue, Feb 12, 2019 at 01:15:45AM +, Sasha Da Rocha Pinheiro wrote: > I found that when libdw will try to get the base CFI from the ABI, the > function ebl_abi_cfi() ends calling default_abi_cfi() which returns -1, when > should be calling x86_64_abi_cfi(). > In addition, the symbol x86_64_

Re: unknown error after dwarf_cfi_addrframe()

2019-02-12 Thread Mark Wielaard
On Tue, Feb 12, 2019 at 07:25:28AM +, Sasha Da Rocha Pinheiro wrote: > Oh this is a whole new thing. How have this worked before without those .so? > After downloading and compiling elfutils we only copy libdw and libelf. The backends are only used for architecture specific ELF things. Most o

Re: unknown error after dwarf_cfi_addrframe()

2019-02-12 Thread Mark Wielaard
On Tue, Feb 12, 2019 at 06:49:54PM +, Sasha Da Rocha Pinheiro wrote: > Since the openbackend() tries to dlopen twice, and in the second turn > it succeeds opening one libebl_x86_64.so, I even tried to redirect that > symbolic link to a newer version of libebl_x86_64-0.165.so, as seen > below.

Re: unknown error after dwarf_cfi_addrframe()

2019-02-12 Thread Mark Wielaard
On Tue, Feb 12, 2019 at 07:47:06PM +, Sasha Da Rocha Pinheiro wrote: > I was using elfutils version 0.175, since we download the lastest. > But after moving back to 0.173, this problem disappeared. So, some > update after 0.173 broke this. That is surprising. Are you sure you configured, build

[COMMITTED] Prepare for 0.176

2019-02-14 Thread Mark Wielaard
Set version to 0.176. Update NEWS and elfutils.spec.in. Update GPG-KEY. Regenerate po/*.po files. Signed-off-by: Mark Wielaard --- ChangeLog | 7 ++ GPG-KEY | 141 -- NEWS| 10 ++ config/ChangeLog| 4

Re: [COMMITTED] Prepare for 0.176

2019-02-14 Thread Mark Wielaard
On Thu, 2019-02-14 at 20:51 +0100, Martin Liška wrote: > I see 2 tests failing for s390x: > https://build.opensuse.org/package/live_build_log/home:marxin:branches:Base:System/elfutils/openSUSE_Factory_zSystems/s390x > So those are basically the same issue: > [ 269s] elflint /home/abuild/rpmbui

Re: [COMMITTED] Prepare for 0.176

2019-02-15 Thread Mark Wielaard
ched patch? I'll run it on some older s390x setups. Thanks, Mark From 1e52d4ce3aa2093d12901d32fe07aae70211fe2a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 15 Feb 2019 14:39:57 +0100 Subject: [PATCH] s390: elflint should check if _GLOBAL_OFFSET_TABLE_ points to .got. The _GLOBAL_OFFSET_TABLE_ sy

Re: [COMMITTED] Prepare for 0.176

2019-02-15 Thread Mark Wielaard
On Fri, 2019-02-15 at 14:43 +0100, Mark Wielaard wrote: > On Fri, 2019-02-15 at 09:42 +0100, Martin Liška wrote: > > > It might be this binutils commit: > > > https://sourceware.org/ml/binutils/2018-07/msg00200.html > > > > > > Which isn't in bin

elfutils 0.176 released

2019-02-15 Thread Mark Wielaard
support. RISC-V: Add untested 32-bit core file support. Mark Wielaard (23): config/upload-release.sh: Need to make before make dist. Add -Wtrampolines to CFLAGS. libelf: Get alignment correct when calling conversion functions. tests: Call test_cleanup in backtrace-subr.sh check_unsupported

Re: Elfutils 0.176 and riscv

2019-02-16 Thread Mark Wielaard
On Sat, Feb 16, 2019 at 06:09:06PM +0100, Kurt Roeckx wrote: > On Debian's riscv64 port, this is a log of the build: > https://buildd.debian.org/status/fetch.php?pkg=elfutils&arch=riscv64&ver=0.176-1&stamp=1550335976&raw=0 You are missing .eh_frame CFI. Without that backtraces will be unreliable.

Symbol versioning (Was: [Bug general/24000] couple of testsuite fails with uclibc library)

2019-02-19 Thread Mark Wielaard
On Tue, Feb 19, 2019 at 07:59:53AM +, Ulf Hermann wrote: > >>> Don't disable symbol versioning, without it binary compatibility is > >>> broken. > >> As per the following commit disabled symbol versioning for uclibc > >> https://sourceware.org/git/?p=elfutils.git;a=commit; > >> h=bafacacaf7659

Re: Symbol versioning (Was: [Bug general/24000] couple of testsuite fails with uclibc library)

2019-02-19 Thread Mark Wielaard
On Tue, Feb 19, 2019 at 11:30:08AM +, Ulf Hermann wrote: > > The problem is that without it every elfutils release would (possibly) > > break the ABI between the shared libraries and programs using them. > > And we don't have/use a different mechanism to indicate symbols/ABI > > changed. How do

[PATCH] libdwf: Initialize notes early in intuit_kernel_bounds.

2019-02-24 Thread Mark Wielaard
We fake initialization of notes with an empty asm statement. But it is simpler and less confusing to just initialize notes just before the fopen. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 6 ++ libdwfl/linux-kernel-modules.c | 7 ++- 2 files changed, 8

[PATCH] libelf: There is just one ELF version.

2019-02-24 Thread Mark Wielaard
id of __libelf_version_initialized. Removes one (or more) array (version) dimension from various tables and accessor functions (__elf_xfctstom, shtype_map, __libelf_data_type, __libelf_type_aligns and __libelf_type_sizes). Signed-off-by: Mark Wielaard ` --- libelf/ChangeLog | 45 ++ l

[PATCH] libelf: Remove unused internal __elf[32|64]_msize functions.

2019-02-24 Thread Mark Wielaard
Those functions were intended for ELF versions where the memory and file sizes of data structures are different. They were never used because libelf depends on the file and memory sizes being equal (otherwise using mmap wouldn't work). Signed-off-by: Mark Wielaard --- libelf/ChangeLog

[PATCH] libelf: Remove unused __elf_xfctstof.

2019-02-24 Thread Mark Wielaard
__elf_xfctstof is only used in case the memory size and file size of ELF data structures are different. This is never the case. Signed-off-by: Mark Wielaard --- libelf/ChangeLog| 5 + libelf/gelf_xlate.c | 4 libelf/libelfP.h| 2 -- 3 files changed, 5 insertions(+), 6 deletions

Re: [PATCH] libdwf: Initialize notes early in intuit_kernel_bounds.

2019-02-28 Thread Mark Wielaard
On Sun, Feb 24, 2019 at 03:11:52PM +0100, Mark Wielaard wrote: > We fake initialization of notes with an empty asm statement. But > it is simpler and less confusing to just initialize notes just > before the fopen. Pushed to master.

Re: [PATCH] libelf: There is just one ELF version.

2019-02-28 Thread Mark Wielaard
On Sun, Feb 24, 2019 at 06:07:17PM +0100, Mark Wielaard wrote: > Remove (partially defined out) code and data structures dealing with > multiple ELF versions. There hasn't been a new ELF version in the > last 20 years. Simplify the code a bit by just assuming there will > on

Re: [PATCH] libelf: Remove unused internal __elf[32|64]_msize functions.

2019-02-28 Thread Mark Wielaard
On Sun, Feb 24, 2019 at 06:14:36PM +0100, Mark Wielaard wrote: > Those functions were intended for ELF versions where the memory and > file sizes of data structures are different. They were never used > because libelf depends on the file and memory sizes being equal > (otherwis

Re: [PATCH] libelf: Remove unused __elf_xfctstof.

2019-02-28 Thread Mark Wielaard
On Sun, Feb 24, 2019 at 06:18:11PM +0100, Mark Wielaard wrote: > __elf_xfctstof is only used in case the memory size and file size of ELF > data structures are different. This is never the case. Pushed to master.

[COMMITTED] tests: Remove tgkill define from backtrace.c

2019-03-04 Thread Mark Wielaard
tgkill is never used in the test and it might conflict with newer glibc which might define tgkill themselves (just like gettid): https://sourceware.org/bugzilla/show_bug.cgi?id=6399 Signed-off-by: Mark Wielaard --- tests/ChangeLog | 4 tests/backtrace.c | 1 - 2 files changed, 4

[COMMITTED] libelf: Fix possible resource leak in elf[32|64]_updatefile.

2019-03-06 Thread Mark Wielaard
When we cannot allocate enough memory to convert the data in updatemmap we should free the scns before returning an error. Signed-off-by: Mark Wielaard --- libelf/ChangeLog | 5 + libelf/elf32_updatefile.c | 1 + 2 files changed, 6 insertions(+) diff --git a/libelf/ChangeLog b

[COMMITTED] libasm: Check return value of gelf_update_ehdr in asm_end.

2019-03-06 Thread Mark Wielaard
In theory the gelf_update_ehdr call could fail. Immediately report an error in that case. Signed-off-by: Mark Wielaard --- libasm/ChangeLog | 4 libasm/asm_end.c | 6 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 92dfd72

[PATCH] libelf: Use posix_memalign instead of aligned_alloc.

2019-03-07 Thread Mark Wielaard
Older glibc might not aligned_alloc (it is C11). Use posix_memalign instead. posix_memalign requires the alignment to be a multiple of sizeof (void *). So use malloc for smaller alignments. Signed-off-by: Mark Wielaard --- libelf/ChangeLog | 5 + libelf/elf32_updatefile.c | 20

Re: [PATCH] libelf: Use posix_memalign instead of aligned_alloc.

2019-03-13 Thread Mark Wielaard
On Thu, 2019-03-07 at 17:35 +0100, Mark Wielaard wrote: > Older glibc might not have aligned_alloc (it is C11). > Use posix_memalign instead. posix_memalign requires the alignment to > be a multiple of sizeof (void *). So use malloc for smaller > alignments. Pushed to master.

[PATCH] readelf: Print DW_AT_data_member_location as decimal offset, not hex number.

2019-04-03 Thread Mark Wielaard
location description, in which case it might have been of DW_FORM_loclist, for which it makes sense to print as hex offset (between square brackets). Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src

Re: [PATCH 0/2] Add C-SKY support

2019-04-03 Thread Mark Wielaard
Hi, On Mon, Apr 01, 2019 at 10:31:55AM +0800, Mao Han wrote: > This patch add backend support for C-SKY architecture. Thanks. I don't know anything about the C-SKY architecture. Do you have an URL to the ELF/DWARF supplemental spec that describes the ELF structures and DWARF register numbers C-S

Re: [PATCH] readelf: Print DW_AT_data_member_location as decimal offset, not hex number.

2019-04-10 Thread Mark Wielaard
On Wed, Apr 03, 2019 at 04:54:15PM +0200, Mark Wielaard wrote: > The data_member_location attribute was printed as a hex number, but other > constant attributes like bit_offset, byte_size or alignment were printed > as decimal numbers. This is confusing. > > The reason that data_

Re: [PATCH V2 0/2] Add C-SKY support

2019-04-14 Thread Mark Wielaard
On Wed, 2019-04-10 at 15:51 +0800, Mao Han wrote: > I'v check some of the failed testcase. Thanks for double checking, it seems we understand all of the cases why they fail except... > > I haven't looked at the code yet, so maybe none of the backtrace tests > > would work even if you could run in

Re: [PATCH V2 1/2] libelf: Sync elf.h from glibc

2019-04-14 Thread Mark Wielaard
On Wed, 2019-04-10 at 15:51 +0800, Mao Han wrote: > +2019-04-01 Mao Han > + > + * elf.h: Update from glibc. Looks like a clean sync from glibc. Pushed to master. Thanks, Mark

Re: [PATCH] wrong backend definition?

2019-04-14 Thread Mark Wielaard
d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 14 Apr 2019 22:40:53 +0200 Subject: [PATCH] backends: riscv_cfi.c had a bad BACKEND define. BACKEND should have been defined as riscv_ (not aarch64_). Reported-by: Mao Han Signed-off-by: Mark Wielaard --- backends/ChangeLog | 4 backend

Re: [PATCH V2 2/2] Add backend support for C-SKY

2019-04-15 Thread Mark Wielaard
On Wed, 2019-04-10 at 15:51 +0800, Mao Han wrote: > C-SKY V2 ABI manual: > https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf > C-SKY architecture user guide: > https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.

[COMMITTED] config: Add git tag --verify to upload-release.sh.

2019-04-15 Thread Mark Wielaard
Add a check to make sure we have to correct (signed) tag. Signed-off-by: Mark Wielaard --- config/ChangeLog | 4 config/upload-release.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/config/ChangeLog b/config/ChangeLog index f956780..9b1cce4 100644 --- a/config/ChangeLog

Re: [PATCH] elfclassify tool

2019-04-15 Thread Mark Wielaard
Hi, On Fri, 2019-04-12 at 17:38 +0200, Florian Weimer wrote: > This patch adds an elfclassify tool, mainly for the benefit of RPM's > find-debuginfo.sh. I have CCed Panu to see if he has any input. > I still need to implement an --unstripped option and fix the > iteration over the dynamic sectio

Re: Dwarf_Op

2019-04-26 Thread Mark Wielaard
Hi Sasha, On Thu, 2019-04-25 at 23:59 +, Sasha Da Rocha Pinheiro wrote: > I have a Dwarf_Op object whose member "number" has size of 8 bytes. > Its value although is 0xFFE8. > Shouldn't it be 0xFFE8 instead? > Since it means an offset, for the current operation, shoul

Re: Dwarf_Op

2019-04-27 Thread Mark Wielaard
On Fri, Apr 26, 2019 at 04:48:49PM +, Sasha Da Rocha Pinheiro wrote: > The output from dwarfdump: > > <5><0x00400918:0x00400974> 0> > > 0x00400918: > 0x0040091c:> > 0x00400920:> > 0x00400970: > > I'm getting the rules for r30 at PC 0x

[COMMITTED] libdw: Reject DW_OP_implicit_value in CFI.

2019-04-27 Thread Mark Wielaard
NULL. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/dwarf_getlocation.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index aaa6296..22fdab3 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2019-04-27

[COMMITTED] libdw: Call check_constant_offset with direct pointers.

2019-04-28 Thread Mark Wielaard
In dwarf_getlocation_addr pass the pointers to llbufs and listlens indirectly by passing a pointer to the first array element. Simplify the code by passing the pointers directly. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/dwarf_getlocation.c | 2 +- 2 files

[COMMITTED] libdw: Remove unused variable initialization in dwarf_siblingof.

2019-04-28 Thread Mark Wielaard
We immediately reassign the value of addr after declaration. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 4 libdw/dwarf_siblingof.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index bc446fe5a..37aab8047 100644 --- a

[COMMITTED] libdwfl: Don't call realloc with zero in cu.c addraranges.

2019-04-28 Thread Mark Wielaard
zero after reduction (which would be invalid DWARF) we are left with a dangling pointer. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 4 libdwfl/cu.c | 7 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 1da888f6f

[COMMITTED] libdwfl: Make sure to left shift a unsigned 64bit value in expr_eval.

2019-04-28 Thread Mark Wielaard
In frame_unwind.c expr_eval we left shift 1 up to 56 bits. We have to make sure we don't left shift a 32bit signed value (that would be undefined behavior). So shift a 1ULL value instead. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 + libdwfl/frame_unwind.c | 2 +- 2

[COMMITTED] libebl: Check ebl is not NULL in ebl_symbol_[binding|type]_name.

2019-04-28 Thread Mark Wielaard
For STB_GNU_UNIQUE and STT_GNU_IFUNC we need to check the elf of the given ebl. Make sure the ebl given isn't NULL. Signed-off-by: Mark Wielaard --- libebl/ChangeLog | 7 +++ libebl/eblsymbolbindingname.c | 1 + libebl/eblsymboltypename.c| 1 + 3 files changed, 9 inser

[COMMITTED] elfcmp: Handle bad sections without crashing.

2019-04-28 Thread Mark Wielaard
If we cannot get the Shdr of a section then don't try to use or compare them. Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 src/elfcmp.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 57db6cadb..3786f3432 100644

[COMMITTED] nm: Simplify naming of invalid sections, check shdr isn't NULL.

2019-04-28 Thread Mark Wielaard
When shdr is NULL or the sh_name index is invalid, don't try to use it. Just call the section "[invalid section name]". Don't try to be too smart by creating a dynamic invalid name using alloca to simplify memory usage in this exceptional case. Signed-off-by: Mark Wielaard

[COMMITTED] size: Robustify against gelf_getshdr returning NULL.

2019-04-28 Thread Mark Wielaard
Signed-off-by: Mark Wielaard --- src/ChangeLog | 7 +++ src/size.c| 6 ++ 2 files changed, 13 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 3020bd768..e3e411ef5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2019-04-28 Mark Wielaard

[COMMITTED] unstrip: Robustify gelf_getshdr and gelf_getsymshndx calls.

2019-04-28 Thread Mark Wielaard
Signed-off-by: Mark Wielaard --- src/ChangeLog | 6 ++ src/unstrip.c | 4 2 files changed, 10 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index e3e411ef5..ae1379327 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2019-04-28 Mark Wielaard

[PATCH] libelf: If xlate can only convert the ELF note header, just do that.

2019-04-30 Thread Mark Wielaard
t the Note header and ignoring the (raw) note data. Signed-off-by: Mark Wielaard --- libelf/note_xlate.h | 12 +++- tests/ChangeLog | 9 +++ tests/Makefile.am | 8 ++- tests/run-xlate-note.sh | 93 tests/xlate_notes.c

[COMMITTED] tests: Don't printf a known NULL symname.

2019-04-30 Thread Mark Wielaard
GCC9 on 32bit systems might warn about '%s' directive argument is null for symname in backtrace.c. Just check whether symname is NULL. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 4 tests/backtrace.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --g

Re: [PATCH] libelf: If xlate can only convert the ELF note header, just do that.

2019-04-30 Thread Mark Wielaard
On Tue, Apr 30, 2019 at 01:24:48PM +0200, Mark Wielaard wrote: > When we started parsing new style ELF_T_NHDR8 notes we added extra > checks on alignment and padding. When those failed we would stop > converting and just return the rest of the ELF Note unconverted. > In the case were

[COMMITTED] tests: Don't printf a known NULL symname in backtrace-dwarf.c.

2019-05-01 Thread Mark Wielaard
GCC9 on 32bit systems might warn about '%s' directive argument is null for symname in backtrace-dwarf.c. Just check whether symname is NULL. This is an identical fix for the same issue as found in backtrace.c, but now in backtrace-dwarf.c Signed-off-by: Mark Wielaard --- tests

[PATCH] libelf: Add n_namesz offset overflow check to gelf_get_note.

2019-05-01 Thread Mark Wielaard
ff-by: Mark Wielaard --- libelf/ChangeLog | 5 + libelf/gelf_getnote.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 5eadaf7..924ff59 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2019-05-01

Re: Dwarf_Op

2019-05-01 Thread Mark Wielaard
On Wed, May 01, 2019 at 05:08:15PM +, Sasha Da Rocha Pinheiro wrote: > yes, I did use dwarf_frame_register(), I believe I mentioned that :). Sorry, I missed that. > In the case I brought up you're saying it was an elfutils' libdw > decision to provide negative number as DW_OP_plus_uconst (uns

Re: Dwarf_Op

2019-05-03 Thread Mark Wielaard
On Thu, May 02, 2019 at 07:29:33PM +, Sasha Da Rocha Pinheiro wrote: > So why not a DW_OP_constu or DW_OP_consts and then a DW_OP_plus? Probably because that is multiple operators and less efficiently encoded. But yes, it would be slightly more "correct" semantically. In this case however it

Re: [PATCH] libelf: If xlate can only convert the ELF note header, just do that.

2019-05-04 Thread Mark Wielaard
On Wed, May 01, 2019 at 12:04:17AM +0200, Mark Wielaard wrote: > On Tue, Apr 30, 2019 at 01:24:48PM +0200, Mark Wielaard wrote: > > When we started parsing new style ELF_T_NHDR8 notes we added extra > > checks on alignment and padding. When those failed we would stop > > conve

Re: [PATCH] libelf: Add n_namesz offset overflow check to gelf_get_note.

2019-05-04 Thread Mark Wielaard
On Wed, May 01, 2019 at 03:55:59PM +0200, Mark Wielaard wrote: > During fuzzing of the new xlate_notes testcase I noticed that > gelf_get_note didn't check whether the n_namesz of a note was > too big. This could lead to offset wrapping around. Causing an > infinite loop going o

Re: [PATCH] lib/color: Fix compilation with uClibc

2019-05-05 Thread Mark Wielaard
On Fri, 2019-05-03 at 10:59 -0700, Rosen Penev wrote: > elfutils passed -Werror and this call errors on uClibc with a > mismatching pointer type. Cast to char * to fix. Aha. I see uClibc defines program_invocation_short_name as a const char*, while glibc defines it as a char *. And argp_help takes

[PATCH] readelf: Clean up section lists after usage.

2019-05-09 Thread Mark Wielaard
Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 14 ++ 2 files changed, 19 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index ae13793..0c817f4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2019-05-09 Mark Wielaard

[PATCH] readelf: Decode DW_AT_discr_list block attributes.

2019-05-10 Thread Mark Wielaard
variant_part (parent) DIE of the variant DIE (which has the discr_list attribute). Add a testcase using both signed and unsigned discriminants. https://sourceware.org/bugzilla/show_bug.cgi?id=24509 Signed-off-by: Mark Wielaard --- src/ChangeLog | 7 + src/readelf.c

Re: Dwarf_Op

2019-05-10 Thread Mark Wielaard
On Wed, May 08, 2019 at 06:03:55PM +, Sasha Da Rocha Pinheiro wrote: > About the *ops returned from dwarf_frame_register(): > Is it correct to say that if we don't get a DW_OP_stack_value as the > last operation, the value on top of the stack will always be a > memory address? Meaning you must

[PATCH] libelf: Mark shdr_flags dirty if offset or size changes during update.

2019-05-12 Thread Mark Wielaard
igned-off-by: Mark Wielaard --- libelf/ChangeLog | 5 ++ libelf/elf32_updatenull.c | 5 +- tests/ChangeLog| 15 + tests/Makefile.am | 5 +- tests/elfcopy.c| 98 +--- tests/elfrdwr

Re: [PATCH] readelf: Clean up section lists after usage.

2019-05-14 Thread Mark Wielaard
On Thu, May 09, 2019 at 04:55:23PM +0200, Mark Wielaard wrote: > +2019-05-09 Mark Wielaard > + > + * readelf.c (cleanup_list): New function. > + (main): Call cleanup_list for dump_data_sections and string_sections. Pushed to master.

Re: [PATCH] readelf: Decode DW_AT_discr_list block attributes.

2019-05-14 Thread Mark Wielaard
On Fri, May 10, 2019 at 11:48:32AM -0600, Tom Tromey wrote: > >>>>> "Mark" == Mark Wielaard writes: > > Mark> Decode DW_AT_descr_list blocks using the DW_DSC values. > Mark> This requires knowing the signedness of the discriminant. > Mark> Which

Re: [PATCH] libelf: Mark shdr_flags dirty if offset or size changes during update.

2019-05-16 Thread Mark Wielaard
On Mon, 2019-05-13 at 00:13 +0200, Mark Wielaard wrote: > We forgot to mark the shdr_flags dirty when only the sh_size or > sh_offset changed during elf_update (). This meant that if there were > no other shdr changes we only wrote out the section data, but didn't > write out the

Re: [PATCH v2] skip the test when gcc not deployed

2019-05-23 Thread Mark Wielaard
Hi, On Tue, May 21, 2019 at 03:33:06PM +0800, mingli...@windriver.com wrote: > Skip the tests which depend on gcc when > gcc not deployed. What exactly are you trying to do? When would you run make check without having gcc installed? If this is to check against an alternative compiler? In the la

Re: How to use test-nlist

2019-05-23 Thread Mark Wielaard
On Thu, May 23, 2019 at 04:52:39PM +0800, Yu, Mingli wrote: > I run some tests about elfutils, but one test as test-nlist always fails as > below: > > # ./tests/test-nlist > nlist failed You are supposed to run it with make check. make check TESTS=test-nlist test-nlist tries to run nlist on itse

Re: How to use test-nlist

2019-05-23 Thread Mark Wielaard
On Fri, May 24, 2019 at 11:00:57AM +0800, Yu, Mingli wrote: > On 2019年05月23日 19:50, Mark Wielaard wrote: > > > # ./tests/test-nlist > > > nlist failed > > > > You are supposed to run it with make check. > > make check TESTS=test-nlist > > > >

Re: How to use test-nlist

2019-05-23 Thread Mark Wielaard
On Fri, May 24, 2019 at 02:36:15PM +0800, Yu, Mingli wrote: > > Yes. See the source code. > > The test tries to run nlist on "./test-nlist". > > Which package provides nlist, I didn't found nlist in my system. nlist is a function in libelf, one of the libraries of elfutils. Cheers, Mark

Re: How to use test-nlist

2019-05-24 Thread Mark Wielaard
On Fri, May 24, 2019 at 02:45:21PM +0800, Yu, Mingli wrote: > And I noticed the source code and already run as "./test-nlist", but Seems > it doesn't work as expected. > # ./test-nlist > # echo $? > 1 > # ./test-nlist -d > nl[0].n_name = "var" > nl[0].n_value = 0 > nl[0].n_scnum = 0 > nl[0].n_type

Re: [PATCH v2] skip the test when gcc not deployed

2019-05-24 Thread Mark Wielaard
Hi, On Fri, May 24, 2019 at 02:47:25PM +0800, Yu, Mingli wrote: > > On Tue, May 21, 2019 at 03:33:06PM +0800, mingli...@windriver.com wrote: > > > Skip the tests which depend on gcc when > > > gcc not deployed. > > > > What exactly are you trying to do? > > When would you run make check without h

[COMMITTED] libebl: Try harder to find backend library in bin and lib origin paths.

2019-05-30 Thread Mark Wielaard
zilla/show_bug.cgi?id=24488 Signed-off-by: Mark Wielaard --- libebl/ChangeLog| 8 libebl/eblopenbackend.c | 117 +--- 2 files changed, 78 insertions(+), 47 deletions(-) diff --git a/libebl/ChangeLog b/libebl/ChangeLog index e050bfc..8a

[COMMITTED] tests: elfcopy --reverse-offs should only swap sections next to each other.

2019-06-03 Thread Mark Wielaard
The run-reverse-sections-self.sh (which really should have been called "swap-sections") could fail if the ELF file had sections that were not directly next to each other swapped. Add a check to make sure the swapped sections are actually directly next to each other. Signed-off-by: Mar

[PATCH] strip don't mmap debug output file.

2019-06-18 Thread Mark Wielaard
first read into the ELF data structure buffers, then written out as a whole. In this case the mmap output buffer is just overhead. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/strip.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/Chang

[PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-06-18 Thread Mark Wielaard
u-elflint, eu-unstrip and eu-elfcmp. Before this patch, that test case fails and creates corrupt ELF files. The test is guarded by some checks that try to make sure there is enough disk space and memory available on the machine. The test is skipped otherwise. Signed-off-by: Mark Wielaa

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-06-19 Thread Mark Wielaard
On Wed, 2019-06-19 at 02:04 +0200, Mark Wielaard wrote: > The patch also contains a testcase. But since it is necessary to create > and process a 4GB+ file it is guarded by some checks to make sure the > machine has enough disk and memory. Do these checks look reasonable? > They prob

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-06-20 Thread Mark Wielaard
On Thu, 2019-06-20 at 04:54 +0300, Dmitry V. Levin wrote: > On Thu, Jun 20, 2019 at 01:10:53AM +0200, Mark Wielaard wrote: > > +# Make sure the disk is reasonably fast, should be able to write > > 100MB/s > > +fast_disk=1 > > +timeout -s9 10s dd conv=fsync if=/de

Re: [PATCH] strip don't mmap debug output file.

2019-06-24 Thread Mark Wielaard
On Tue, 2019-06-18 at 13:50 +0200, Mark Wielaard wrote: > Using ELF_C_WRITE_MMAP sometimes causes unexpected errors when disk > space is low. When writing out the file, the output file is first > extended so that it covers the whole file/mmap size. But it might > be that the file sy

Re: [PATCH V2 0/2] Add C-SKY support

2019-06-24 Thread Mark Wielaard
akes sure we are properly attached. */ You are totally correct. I have installed the attached patch. Thanks, Mark From ac9e5349dd662289485e67403be943a4ec78cd4d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 25 Jun 2019 00:21:42 +0200 Subject: [PATCH] stack: Fix error message when dwfl

Re: Elf64_Phdr

2019-06-24 Thread Mark Wielaard
On Tue, 2019-06-25 at 05:22 +, Sasha Da Rocha Pinheiro wrote: > Oh, of course, that might be it. > > Do you know if when it's open with write permission, changes will be > mapped back to the file? That depends on whether it is opened with mmap MAP_PRIVATE (ELF_C_READ_MMAP_PRIVATE,) or

Re: Elf64_Phdr

2019-06-27 Thread Mark Wielaard
On Tue, 2019-06-25 at 22:09 +, Sasha Da Rocha Pinheiro wrote: > > What happens if I call elf64_newphdr() on the same Elf * but with > different size_t __cnt? It creates a new phdr table for the Elf with cnt entries, whether or not the phdr table existed or not. If cnt is zero any existing

Re: Elf64_Phdr

2019-06-27 Thread Mark Wielaard
On Wed, 2019-06-26 at 20:01 +, Sasha Da Rocha Pinheiro wrote: > So, I need to write an elf file. I have an open Elf * handle with > read only permission. I then need to update the program headers and > next add a new program header entry. > For that we create an Elf * handle with write permissi

[PATCH] libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.

2019-06-28 Thread Mark Wielaard
e_machine value. Since this was the only usage of ebl->name, remove that from struct ebl. Also add a testcase that makes sure dwelf_elf_e_machine_string works for all EM values in the libelf/elf.h header so we will immediately notice when a new value appears. Signed-off-by: Mark Wiela

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-06-28 Thread Mark Wielaard
Hi, I pushed this to master with the changes suggested by Dmitry. Thanks, Mark

Re: Buildbot failure in Wildebeest Builder on whole buildset

2019-06-28 Thread Mark Wielaard
On Fri, Jun 28, 2019 at 11:02:02PM +, build...@builder.wildebeest.org wrote: > The Buildbot has detected a failed build on builder whole buildset while > building elfutils. > Full details are available at: > https://builder.wildebeest.org/buildbot/#builders/1/builds/376 > > Buildbot URL:

Re: Buildbot failure in Wildebeest Builder on whole buildset

2019-07-01 Thread Mark Wielaard
On Sat, 2019-06-29 at 01:47 +0200, Mark Wielaard wrote: > FAIL: run-large-elf-file.sh > === > > long_bit: 64 > space_available: 38 > mem_available: 7 > 1024+0 records in > 1024+0 records out > 1073741824 bytes (1.1 GB) copied, 3.72662 s, 288 MB/s

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-07-02 Thread Mark Wielaard
Hi, On Tue, 2019-07-02 at 11:40 -0700, Lei Zhang wrote: > I tested and found some problems. My test procedure is to: > - Build elfutils at commit 31c8b3f098b0654db8f573b2a15d5b6d07d4d3b0 > - Replace Chromium's buildtools/third_party/eu-strip/bin/eu-strip with > the newly built strip binary. > - Do

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-07-03 Thread Mark Wielaard
Hi, On Tue, 2019-07-02 at 16:21 -0700, Lei Zhang wrote: > On Tue, Jul 2, 2019 at 4:15 PM Mark Wielaard wrote: > > I'll try to create a testcase to replicate the issue to see if I can > > debug where the offset value gets truncated. > > Sounds good to me. > > &g

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-07-03 Thread Mark Wielaard
On Wed, 2019-07-03 at 08:23 -0700, Lei Zhang wrote: > On Wed, Jul 3, 2019 at 7:53 AM Mark Wielaard wrote: > > Thanks for the file, it is indeed pretty big :) > > But I am not able to replicate the issue with elfutils from git > > trunk. > > commit 31c8b3f098b06

Re: debuginfo server progress update

2019-07-05 Thread Mark Wielaard
Hi Aaron, On Wed, Jul 03, 2019 at 03:59:46PM -0400, Aaron Merey wrote: > The debuginfo server, a web service that offers lightweight on-demand lookups > of debuginfo-related data, along with its elfutils client have begun to take > shape so I want to provide an update on where we currently are in

Re: [RFC PATCH 0/2] elfutils: don't use dlopen() for libebl modules

2019-07-08 Thread Mark Wielaard
Hi Omar, On Wed, 2019-07-03 at 13:03 -0700, Omar Sandoval wrote: > I'm developing an application which uses libdwfl. When I tested it in > our production environment, the application hit DWARF parsing errors for > Linux kernel modules. I tracked it down to an issue that ELF relocations > were sile

Re: [RFC PATCH 0/2] elfutils: don't use dlopen() for libebl modules

2019-07-08 Thread Mark Wielaard
On Wed, 2019-07-03 at 20:56 -0400, Frank Ch. Eigler wrote: > > Some of the binaries use libebl, and although libebl is linked into > > libdw.so, > > the libebl symbols are not exported by libdw. So, libebl is linked in > > statically for the binaries. > > > > This is why I suggested exporting tho

Re: [PATCH 5/5] libdw: export libebl symbols

2019-07-08 Thread Mark Wielaard
Hi, On Fri, 2019-07-05 at 17:34 -0700, Omar Sandoval wrote: > The main downside of the previous change to build in all libebl backend > modules statically is that the total installed size of elfutils > increased (from 2.1 MB to 3.5 MB in my case). This is because we have to > statically link libeb

Re: [RFC PATCH 0/2] elfutils: don't use dlopen() for libebl modules

2019-07-09 Thread Mark Wielaard
Hi Omar, On Mon, 2019-07-08 at 14:02 -0700, Omar Sandoval wrote: > I imagine that little by little, most of the libebl functionality could > be converted in this way, and that's how we could chip away at the size > increase of the elfutils binaries. > > Do you have any objections to patches 1-4 o

Re: [PATCH] libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.

2019-07-10 Thread Mark Wielaard
On Fri, 2019-06-28 at 23:07 +0200, Mark Wielaard wrote: > To print eh human readable description of the ELF e_machine header field > we used the ebl name. But this is not set for most EM constants. Introduce > a new function dwelf_elf_e_machine_string that does work for all known > EM

<    9   10   11   12   13   14   15   16   17   18   >