[COMMITTED] tests: backtrace-dwarf.c improve error handling in test framework.

2018-09-21 Thread Mark Wielaard
To debug https://sourceware.org/bugzilla/show_bug.cgi?id=23673 clean up the test framework so we know what exactly failed. Suggested-by: Dmitry V. Levin Signed-off-by: Mark Wielaard --- tests/ChangeLog | 7 +++ tests/backtrace-dwarf.c | 38 -- 2

Re: Handling pgoff in perf elf mmap/mmap2 elf info

2018-09-21 Thread Mark Wielaard
On Wed, 2018-09-19 at 14:24 +0200, Ulf Hermann wrote: > > We suspect perf to offset its recording-addresses of mmapped > > dsos/executables starting with a specific section, such that they > > denote > > their pointers with this pg_offset parameter. (e.g. skipping a > > library's > > header and set

Re: Handling pgoff in perf elf mmap/mmap2 elf info

2018-10-11 Thread Mark Wielaard
Hi, My apologies for not having looked deeper at this. It is a bit tricky and I just didnt have enough time to really sit down and think it all through yet. On Thu, Oct 11, 2018 at 05:02:18PM +, Ulf Hermann wrote: > is there any pattern in how the loader maps the ELF sections into > memory?

[PATCH] strip, unstrip: Handle SHT_GROUP correctly.

2018-10-13 Thread Mark Wielaard
n the group sections have the exact same name (".group"), flags (none) and sometimes the same sizes. Which makes matching them hard. Extract the group signature and compare those when comparing two group sections. Signed-off-by: Mark Wielaard --- src/ChangeLog

[PATCH] readelf: Handle multiple .debug_macro sections and decode header flag.

2018-10-13 Thread Mark Wielaard
x27;t have that information and no interface yet for libdw users. Also decode the macro header flag byte for convenience. Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 + src/readelf.c | 31 ++- tests/ChangeLog| 10 + tests/run-r

Re: [PATCH] Handle ADD/SUB relocations

2018-10-13 Thread Mark Wielaard
Hi Andreas, On Tue, 2018-10-02 at 14:46 +0200, Andreas Schwab wrote: > This adds support for ADD and SUB relocations as seen on RISC-V. Sorry this took 2 weeks. I should have reviewed it immediately because it looks just perfect. I pushed it to master. Thanks, Mark

[PATCH] libdwfl: Sanity check partial core file data reads.

2018-10-14 Thread Mark Wielaard
ff-by: Mark Wielaard --- libdwfl/ChangeLog| 7 +++ libdwfl/dwfl_segment_report_module.c | 13 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index c5ea563..2e7efd4 100644 --- a/libdwfl/ChangeLog +++ b/li

[PATCH] findtextrel: Check that sh_entsize isn't zero.

2018-10-14 Thread Mark Wielaard
A bogus ELF file could have sh_entsize as zero. Don't divide by zero, but just assume there are no entries in the section. https://sourceware.org/bugzilla/show_bug.cgi?id=23755 Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 src/findtextrel.c | 23 +-- 2

[PATCH] ar: Assume epoch if ar_date is bogus.

2018-10-14 Thread Mark Wielaard
If the ar header contains a bogus ar_date then in verbose mode we would get a NULL pointer from localtime. Just assume the entry was created during the epoch. https://sourceware.org/bugzilla/show_bug.cgi?id=23754 Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 src/ar.c | 10

Re: Handling pgoff in perf elf mmap/mmap2 elf info

2018-10-15 Thread Mark Wielaard
Hi Milian, On Mon, 2018-10-15 at 22:38 +0200, Milian Wolff wrote: > here's one example of mmap events recorded by perf: > > 0x7fac5ec0b000 to 0x7fac5ed9a000, len =   0x18f000, offset =0  >    > r--p/usr/lib/libstdc++.so.6.0.25 > 0x7fac5ec94000 to 0x7fac5ed8a000, len =0xf60

[PATCH] readelf: Make sure readp is smaller than cieend in print_debug_frame_section.

2018-10-16 Thread Mark Wielaard
We could end up with a negative length in a call to memchr. https://sourceware.org/bugzilla/show_bug.cgi?id=23782 Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 12 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src

Re: [PATCH] strip, unstrip: Handle SHT_GROUP correctly.

2018-10-17 Thread Mark Wielaard
On Sat, 2018-10-13 at 10:46 +0200, Mark Wielaard wrote: > The usage of annobin in Fedora showed a couple of bugs when using > eu-strip and eu-unstrip on ET_REL files that contain multiple group > sections. > > When stripping we should not remove the SHF_GROUP flag from section

Re: Handling pgoff in perf elf mmap/mmap2 elf info

2018-10-17 Thread Mark Wielaard
Hi Milian, On Wed, Oct 17, 2018 at 04:52:42PM +0200, Milian Wolff wrote: > On Montag, 15. Oktober 2018 23:06:07 CEST Milian Wolff wrote: > > On Montag, 15. Oktober 2018 23:04:52 CEST Mark Wielaard wrote: > > > On Mon, 2018-10-15 at 22:38 +0200, Milian Wolff wrote: > > &

[PATCH] arlib: Check that sh_entsize isn't zero.

2018-10-18 Thread Mark Wielaard
A bogus ELF file could have sh_entsize as zero. Don't divide by zero, but just assume there are no symbols in the section. https://sourceware.org/bugzilla/show_bug.cgi?id=23786 Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 src/arlib.c | 3 +++ 2 files changed, 7 inser

[PATCH] size: Handle recursive ELF ar files.

2018-10-18 Thread Mark Wielaard
eu-size didn't handle an ELF ar file that contained an ar file itself correctly. handle_ar would recursively call itself but close the ELF file before returning. Only close the ELF file at the top-level. https://sourceware.org/bugzilla/show_bug.cgi?id=23787 Signed-off-by: Mark Wielaard ---

[PATCH] Recognize and parse GNU Property notes.

2018-10-19 Thread Mark Wielaard
ct the GNU_PROPERTY_STACK_SIZE, GNU_PROPERTY_NO_COPY_ON_PROTECTED and GNU_PROPERTY_X86_FEATURE_1_AND types GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK. Tests are added for extracting the note from sections or segments as set by gcc -fcf-protection. Signed-off-by: Mark Wie

[PATCH] Check sh_entsize is not zero.

2018-10-19 Thread Mark Wielaard
-off-by: Mark Wielaard --- libasm/ChangeLog | 4 libasm/disasm_cb.c | 2 ++ libdwfl/ChangeLog | 4 libdwfl/dwfl_module_getdwarf.c | 2 ++ src/ChangeLog | 7 +++ src/unstrip.c | 27

Re: [PATCH] strip, unstrip: Handle SHT_GROUP correctly.

2018-10-19 Thread Mark Wielaard
After a bit more testing found one other issue. It can happen that the section indexes in the group need to be renumbered when eu-unstrip puts the stripped and debug file together again. So we need to explicitly do that.commit eee4269e53154daaf0251371aacd91ec5db3eb30 Author: Mark Wielaard Date

Re: [PATCH] readelf: Handle multiple .debug_macro sections and decode header flag.

2018-10-19 Thread Mark Wielaard
On Sat, 2018-10-13 at 15:17 +0200, Mark Wielaard wrote: > In object files there could be multiple .debug_macro sections. > These are COMDAT sections used as imports. Note that the output for > DW_MACRO_import isn't ideal since the offset is printed against the > start of the .de

Re: [PATCH] libdwfl: Sanity check partial core file data reads.

2018-10-19 Thread Mark Wielaard
On Sun, 2018-10-14 at 16:48 +0200, Mark Wielaard wrote: > There were two issues when reading note data from a core file. > We didn't check if the data we already had in a buffer was big > enough. And if we did get the data, we should check if we got > everything, or just a

Re: [PATCH] findtextrel: Check that sh_entsize isn't zero.

2018-10-19 Thread Mark Wielaard
On Sun, 2018-10-14 at 16:59 +0200, Mark Wielaard wrote: > A bogus ELF file could have sh_entsize as zero. Don't divide by zero, > but just assume there are no entries in the section. Pushed to master.

Re: [PATCH] ar: Assume epoch if ar_date is bogus.

2018-10-19 Thread Mark Wielaard
On Sun, 2018-10-14 at 17:31 +0200, Mark Wielaard wrote: > If the ar header contains a bogus ar_date then in verbose mode we > would > get a NULL pointer from localtime. Just assume the entry was created > during the epoch. Pushed to master.

Re: [PATCH] readelf: Make sure readp is smaller than cieend in print_debug_frame_section.

2018-10-19 Thread Mark Wielaard
On Tue, 2018-10-16 at 14:22 +0200, Mark Wielaard wrote: > We could end up with a negative length in a call to memchr. Pushed to master.

Re: [PATCH] arlib: Check that sh_entsize isn't zero.

2018-10-19 Thread Mark Wielaard
On Thu, 2018-10-18 at 19:02 +0200, Mark Wielaard wrote: > A bogus ELF file could have sh_entsize as zero. Don't divide by zero, > but just assume there are no symbols in the section. Pushed to master.

Re: [PATCH] size: Handle recursive ELF ar files.

2018-10-19 Thread Mark Wielaard
On Fri, 2018-10-19 at 01:02 +0200, Mark Wielaard wrote: > eu-size didn't handle an ELF ar file that contained an ar file itself > correctly. handle_ar would recursively call itself but close the ELF > file before returning. Only close the ELF file at the top-level. Pushed to master.

Re: [PATCH] Check sh_entsize is not zero.

2018-10-19 Thread Mark Wielaard
On Fri, 2018-10-19 at 15:03 +0200, Mark Wielaard wrote: > There were some recent bug reports where we trusted the ELF section > header > to be sane and divided the sh_size by the sh_entsize to get the > number of > objects in the section. This would cause a divide by zero if

[COMMITTED] backends: ppc use define instead of const for size of dwarf_regs array.

2018-10-20 Thread Mark Wielaard
The size of the dwarf_regs is a constant, but when building without optimizations the compiler doesn't see that and will warn that it cannot proof the stack size is bounded. Use a define instead of a const, so the compiler will use a constant expression everywhere. Signed-off-by: Mark Wie

[PATCH] libdwelf: New function dwelf_elf_begin.

2018-10-21 Thread Mark Wielaard
nd needs duplicating the file handle. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 4 +++ libdw/libdw.map | 5 libdwelf/ChangeLog | 8 +- libdwelf/Makefile.am| 2 +- libdwelf/dwelf_e

[PATCH] readelf: Use shstrndx to lookup section names.

2018-10-24 Thread Mark Wielaard
The function section_name would use the Ehdr e_shstrndx field to find the index of the section index string table directly. But it should use elf_getshdrstrndx. Adjust all callers. Signed-off-by: Mark Wielaard --- src/ChangeLog | 21 +++ src/readelf.c | 82

[PATCH] addr2line: Use elf_getshdrstrndx not Ehdr field to print section name.

2018-10-24 Thread Mark Wielaard
Using the Ehdr field directly doesn't work when there are a large number of sections. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/addr2line.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bd6751a..50

[PATCH 1/4] strip: Always copy over any phdrs if there are any.

2018-10-26 Thread Mark Wielaard
Ignore the type of ELF file, just copy over any phdrs if the original file contained any. Also refuse to move around any allocated sections based on whether there are any phdrs instead of on ELF file type. Signed-off-by: Mark Wielaard --- src/ChangeLog | 6 + src/strip.c | 70

Add eu-strip --reloc-debug-sections-only option

2018-10-26 Thread Mark Wielaard
Hi, eu-strip already supports --reloc-debug-sections to resolve all relocations between .debug_ sections while creating a separate .debug file with -f. It is sometimes useful to do the same without doing any other stripping. --reloc-debug-sections-only Similar to --relo

[PATCH 2/4] strip: Split out debug section relocation into separate helper functions.

2018-10-26 Thread Mark Wielaard
Extract a couple of helper functions out of handle_elf (secndx_name, get_xndxdata and remove_debug_relocations) so they can be reused more easily in the future. Signed-off-by: Mark Wielaard --- src/ChangeLog | 7 + src/strip.c | 541

[PATCH 3/4] strip: Extract code to update shdrstrndx into new common function.

2018-10-26 Thread Mark Wielaard
Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 src/strip.c | 94 +++ 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f55ff6c..766c839 100644 --- a/src/ChangeLog +++ b/src

[PATCH 4/4] strip: Add --reloc-debug-sections-only option.

2018-10-26 Thread Mark Wielaard
you don't want to strip, but for which the debug section relocations can be resolved already. Signed-off-by: Mark Wielaard --- src/ChangeLog| 11 src/strip.c | 155 +-- tests/ChangeLog | 4 ++ tests/run-

Re: [PATCH] addr2line: Use elf_getshdrstrndx not Ehdr field to print section name.

2018-10-26 Thread Mark Wielaard
On Wed, 2018-10-24 at 16:18 +0200, Mark Wielaard wrote: > Using the Ehdr field directly doesn't work when there are a large > number of sections. Pushed to master.

Re: [PATCH] readelf: Use shstrndx to lookup section names.

2018-10-26 Thread Mark Wielaard
On Wed, 2018-10-24 at 16:01 +0200, Mark Wielaard wrote: > The function section_name would use the Ehdr e_shstrndx field to find the > index of the section index string table directly. But it should use > elf_getshdrstrndx. Adjust all callers. Pushed to master.

Re: [PATCH] Recognize and parse GNU Property notes.

2018-10-28 Thread Mark Wielaard
On Fri, 2018-10-19 at 12:26 +0200, Mark Wielaard wrote: > GNU Property notes are different from normal notes because they use > variable alignment/padding of their fields. They are 8 byte aligned, > but use 4 byte fields. The name is aligned at 4 bytes and padded so > that, the desc i

[COMMITTED] unstrip: Add ELF_CHECK to make sure gelf_getehdr () doesn't return NULL.

2018-11-02 Thread Mark Wielaard
Although we would most likely have seen an error before, make sure we provide a proper error message in the unlikely case gelf_getehdr () returns NULL. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/unstrip.c | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ChangeLog b

Re: [PATCH] libdwelf: New function dwelf_elf_begin.

2018-11-04 Thread Mark Wielaard
On Mon, 2018-10-22 at 01:47 +0200, Mark Wielaard wrote: > It currently wraps __libdw_open_file which makes error handling > slight tricky and needs duplicating the file handle. Which introduced some confusion that could cause the file descriptor to leak. The attached updated patch adds a v

[PATCH] libcpu: Recognize bpf jump variants BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLE

2018-11-04 Thread Mark Wielaard
ween a register and another register or immediate. Add these new constants to bpf.h, recognize them in bpf_disasm and update the testfile-bpf-dis1.expect file. Signed-off-by: Mark Wielaard --- lib/ChangeLog | 4 lib/bpf.h | 4 libcpu/Cha

Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND

2018-11-04 Thread Mark Wielaard
On Mon, 2018-10-29 at 16:21 +0100, Milian Wolff wrote: > On my system with g++ (GCC) 8.2.1 20180831 with GNU gold (GNU > Binutils > 2.31.1) 1.16, the .eh_frame section does not have type PROGBITS > but rather is using X86_64_UNWIND nowadays: Urgh, who thought it would be a good idea to have a arch

Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND

2018-11-06 Thread Mark Wielaard
Hi Milian, On Tue, 2018-11-06 at 00:12 +0100, Milian Wolff wrote: > On Montag, 5. November 2018 00:04:32 CET Mark Wielaard wrote: > > Interestingly, when I try to reproduce this on my laptop (i.e. compile even > the trivial C example), then I cannot reproduce this at all a

Re: Add eu-strip --reloc-debug-sections-only option

2018-11-06 Thread Mark Wielaard
On Fri, 2018-10-26 at 23:50 +0200, Mark Wielaard wrote: > eu-strip already supports --reloc-debug-sections to resolve all > relocations between .debug_ sections while creating a separate > .debug file with -f. It is sometimes useful to do the same without > doing any oth

Re: [PATCH 4/4] strip: Add --reloc-debug-sections-only option.

2018-11-06 Thread Mark Wielaard
On Fri, 2018-10-26 at 23:50 +0200, Mark Wielaard wrote: > diff --git a/tests/ChangeLog b/tests/ChangeLog > index 751a081..0870d4c 100644 > --- a/tests/ChangeLog > +++ b/tests/ChangeLog > @@ -1,3 +1,7 @@ > +2018-10-26 Mark Wielaard > + > + * run-strip-reloc.sh: Add

Re: Elfutils new release

2018-11-07 Thread Mark Wielaard
On Wed, 2018-11-07 at 14:15 +, Karbownik, Anna wrote: > I'd like to ask you whether you plan to release 0.175 elfutils > version? There are enough (small) new features and bug fixes to do a new release. Lets aim for next week. There are still a couple of patches cooking on the mailinglist an

Re: [PATCH 4/4] strip: Add --reloc-debug-sections-only option.

2018-11-09 Thread Mark Wielaard
On Tue, Nov 06, 2018 at 03:21:24PM +0100, Mark Wielaard wrote: > The buildbot didn't sent any failure emails (I am still looking into > why), but this new cmp test failed on debian-armhf, fedora-ppc64 and > fedora-ppc64le: > https://builder.wildebeest.org/buildbot/#/builders/15/

[PATCH] strip: Also handle gnu compressed debug sections with --reloc-debug-sections

2018-11-09 Thread Mark Wielaard
e original input file). Add compressed ET_REL tests to run-strip-reloc.sh testcase. Signed-off-by: Mark Wielaard --- libelf/ChangeLog | 4 libelf/elf_compress_gnu.c | 7 --- src/ChangeLog | 5 + src/strip.c | 29 +++---

Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND

2018-11-09 Thread Mark Wielaard
On Wed, Nov 07, 2018 at 10:02:54AM +0100, Milian Wolff wrote: > On Dienstag, 6. November 2018 12:06:57 CET Mark Wielaard wrote: > > It seems to only happen with a specific combination of gcc and the gold > > linker, I could only generate the SHT_X86_64_UNWIND sections only on >

Re: [PATCH] libdwelf: New function dwelf_elf_begin.

2018-11-09 Thread Mark Wielaard
On Sun, Nov 04, 2018 at 05:37:42PM +0100, Mark Wielaard wrote: > On Mon, 2018-10-22 at 01:47 +0200, Mark Wielaard wrote: > > It currently wraps __libdw_open_file which makes error handling > > slight tricky and needs duplicating the file handle. > > Which introduced some

Re: [PATCH] libcpu: Recognize bpf jump variants BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLE

2018-11-09 Thread Mark Wielaard
On Sun, Nov 04, 2018 at 09:40:32PM +0100, Mark Wielaard wrote: > Linux kernel 4.13 introduced 4 more jump class variants. > > commit 92b31a9af73b3a3fc801899335d6c47966351830 > Author: Daniel Borkmann > Date: Thu Aug 10 01:39:55 2017 +0200 > > bpf: ad

Re: Buildbot failure in Wildebeest Builder on whole buildset

2018-11-10 Thread Mark Wielaard
On Sat, 2018-11-10 at 12:31 +, 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/3/builds/296 > > Buildbot URL: https://

Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND

2018-11-10 Thread Mark Wielaard
ep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 10 Nov 2018 23:33:03 +0100 Subject: [PATCH] elflint: Allow PT_GNU_EH_FRAME segment to match SHT_X86_64_UNWIND section. The gold linker might generate an .eh_frame_hdr with a SHT_X86_64_UNWIND type instead of a SHT_PROGBITS type. Signed-off-

[PATCH] Recognize NT_VERSION notes.

2018-11-11 Thread Mark Wielaard
NT_VERSION notes are emitted by the gas .version directive. They have an empty description and (ab)use the owner name to store the version data string. Signed-off-by: Mark Wielaard --- libebl/ChangeLog| 9 + libebl/eblobjnote.c | 10 +- libebl

[PATCH] Handle GNU Build Attribute ELF Notes.

2018-11-12 Thread Mark Wielaard
GA 0 GNU Build Attribute OPEN "stack_realign": FALSE A new test was added to run-readelf -n for the existing annobin file. Signed-off-by: Mark Wielaard --- libebl/ChangeLog| 8 +++ libebl/eblobjnote.c | 151 +

Re: [PATCH] Recognize NT_VERSION notes.

2018-11-13 Thread Mark Wielaard
On Mon, 2018-11-12 at 00:08 +0100, Mark Wielaard wrote: > NT_VERSION notes are emitted by the gas .version directive. > They have an empty description and (ab)use the owner name to store > the version data string. I pushed this to master because it is a prerequisite of the GNU Build Attr

Re: [PATCH] Handle GNU Build Attribute ELF Notes.

2018-11-13 Thread Mark Wielaard
On Tue, 2018-11-13 at 11:56 +, Nick Clifton wrote: > + /* There might or might not be a pair of addresses in the desc. */ > > FYI - There was an old version of the Watermark specification that only put > one address into the note's desc field. This version was never used in > production bina

Re: [PATCH] strip: Also handle gnu compressed debug sections with --reloc-debug-sections

2018-11-13 Thread Mark Wielaard
On Fri, 2018-11-09 at 17:41 +0100, Mark Wielaard wrote: > Check whether a section was gnu compressed and decompress it first > before trying to resolve relocations. Recompress it afterwards. > > This found a bug in elf_compress_gnu which would use the "raw" file > cont

Re: Buildbot failure in Wildebeest Builder on whole buildset

2018-11-13 Thread Mark Wielaard
On Tue, 2018-11-13 at 16:42 +, 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/3/builds/299 This is disappointing. You

Re: Buildbot failure in Wildebeest Builder on whole buildset

2018-11-13 Thread Mark Wielaard
On Tue, 2018-11-13 at 18:29 +0100, Mark Wielaard wrote: > So we might actually have two bugs. 1) we don't handle incorrectly > aligned compressed sections and 2) we generate such incorrectly > aligned compressed sections ourselves. > > Pondering fixes. The fixes were

Re: [PATCH] Also find CFI in sections of type SHT_X86_64_UNWIND

2018-11-13 Thread Mark Wielaard
On Sun, 2018-11-11 at 00:28 +0100, Mark Wielaard wrote: > Found another issue while testing with a gcc 8.1 and gold setup I > noticed some self-tests failed because elflint doesn't know about > SHT_X86_64_UNWIND section type and cannot match the PT_GNU_EH_FRAME > segment. The att

Prepare for 0.175

2018-11-14 Thread Mark Wielaard
Set version to 0.175 Update NEWS and elfutils.spec.in. Regenerate po/*.po files. Signed-off-by: Mark Wielaard --- NEWS| 18 + config/elfutils.spec.in | 14 + configure.ac|2 +- po/de.po| 1162

Re: Elfutils new release

2018-11-14 Thread Mark Wielaard
On Wed, 2018-11-07 at 15:33 +0100, Mark Wielaard wrote: > On Wed, 2018-11-07 at 14:15 +, Karbownik, Anna wrote: > > I'd like to ask you whether you plan to release 0.175 elfutils > > version? > > There are enough (small) new features and bug fixes to do a new > re

Re: [PATCH] Handle GNU Build Attribute ELF Notes.

2018-11-14 Thread Mark Wielaard
Hi Nick, I have a local hack that defines SHF_GNU_BUILD_NOTE and allows it in elflint. But without any documentation on what the semantics of this section flag are. I cannot find this flag being used in the binaries generated on Fedora 29. Is this flag ever used? Thanks, Mark

[PATCH] libebl: Don't update w, t and len unnecessarily in ebl_object_note_type_name.

2018-11-15 Thread Mark Wielaard
Harmless, but useless. Signed-off-by: Mark Wielaard --- libebl/ChangeLog| 5 + libebl/eblobjnotetypename.c | 8 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 79a2ff4..a2f8956 100644 --- a/libebl/ChangeLog +++ b

Re: [PATCH] libebl: Don't update w, t and len unnecessarily in ebl_object_note_type_name.

2018-11-16 Thread Mark Wielaard
On Thu, Nov 15, 2018 at 03:55:12PM +0100, Mark Wielaard wrote: > Harmless, but useless. Pushed to master.

elfutils 0.175 released

2018-11-16 Thread Mark Wielaard
BPF_JSLE. backends: RISCV handles ADD/SUB relocations. Handle SHT_X86_64_UNWIND. Fixes CVE-2018-18310, CVE-2018-18520 and CVE-2018-18521. * GIT SHORTLOG * Andreas Schwab (1): Handle ADD/SUB relocations Mark Wielaard (34): tests: backtrace-dwarf.c improve error handling in test framework

[PATCH] libelf: Get alignement correct when calling conversion functions.

2018-11-18 Thread Mark Wielaard
nt Signed-off-by: Mark Wielaard --- libelf/ChangeLog | 5 libelf/elf32_updatefile.c | 36 tests/ChangeLog| 7 ++ tests/Makefile.am | 6 +++-- tests/run-strip-version.sh | 58 ++

Re: elfutils 0.175 released

2018-11-18 Thread Mark Wielaard
On Sun, Nov 18, 2018 at 11:46:29PM +0100, Kurt Roeckx wrote: > On Fri, Nov 16, 2018 at 02:00:46PM +0100, Mark Wielaard wrote: > > ELFUTILS 0.175 - http://elfutils.org/ > > > > A new release of elfutils is available at: > > ftp://sourceware.org/pub/elfutils/0.175/ &g

[PATCH] Add -Wtrampolines to CFLAGS.

2018-11-19 Thread Mark Wielaard
-Wtrampolines to CLAGS to make sure we don't. Signed-off-by: Mark Wielaard --- config/ChangeLog | 4 config/eu.am | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/ChangeLog b/config/ChangeLog index f281eb2..40d6f85 100644 --- a/config/ChangeLog +++ b/c

Re: elfutils 0.175 released

2018-11-20 Thread Mark Wielaard
On Tue, 2018-11-20 at 00:43 +0100, Kurt Roeckx wrote: > On Fri, Nov 16, 2018 at 02:00:46PM +0100, Mark Wielaard wrote: > > ELFUTILS 0.175 - http://elfutils.org/ > > > > A new release of elfutils is available at: > > ftp://sourceware.org/pub/elfutils/0.175/ > > o

Re: [PATCH] Add -Wtrampolines to CFLAGS.

2018-11-21 Thread Mark Wielaard
On Mon, 2018-11-19 at 11:54 +0100, Mark Wielaard wrote: > elfutils uses nested functions a lot. This is fine unless one takes > the > address of such a nested function. When taking the address of a > nested > function a trampoline is generated that on some systems require the

Re: [PATCH] libelf: Get alignement correct when calling conversion functions.

2018-11-21 Thread Mark Wielaard
On Sun, 2018-11-18 at 15:38 +0100, Mark Wielaard wrote: > When writing out data that needs to be converted we have to make sure > the conversion function is called on correctly aligned buffers. When > using mmap this might mean we have to convert into a temporarily > buffer > if th

[PATCH] libdw: Enable building with -Og.

2018-11-23 Thread Mark Wielaard
return if an error occurs anyway. https://sourceware.org/bugzilla/show_bug.cgi?id=23914 Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 5 + libdw/dwarf_child.c| 2 +- libdw/dwarf_getattrs.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libdw/ChangeLog b

[PATCH] libdwfl: Fix relocation overlap sanity check.

2018-11-23 Thread Mark Wielaard
dn't get relocations applied. Signed-off-by: Mark Wielaard --- The diff might look big, but without the whitespace changes it is just: @@ -561,7 +562,13 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, shdrs or phdrs data then we refuse to do the relocations. I

Re: [PATCH] libdwfl: Fix relocation overlap sanity check.

2018-11-26 Thread Mark Wielaard
On Fri, 2018-11-23 at 21:20 +0100, Mark Wielaard wrote: > We would not relocate when the relocation section data or the target > section date would overlap with one of the ELF headers. This is only > really necessary if the data comes directly from the mmapped file. > Otherwise ther

Re: [PATCH] libdw: Enable building with -Og.

2018-11-26 Thread Mark Wielaard
On Fri, 2018-11-23 at 21:08 +0100, Mark Wielaard wrote: > When building with -Og gcc is unable to see that __libdw_dieabbrev () > will initialize what the second argument points to when no error > occurs > as called by dwarf_child and dwarf_getattrs. Causing an possibly > uninitiali

[PATCH] libebl: Fix reading GNU_PROPERTY_STACK_SIZE reading from 32bit notes.

2018-12-02 Thread Mark Wielaard
-off-by: Mark Wielaard --- libebl/ChangeLog| 5 ++ libebl/eblobjnote.c | 20 -- tests/ChangeLog | 9 +++ tests/Makefile.am | 4 ++ tests/run-readelf-n.sh | 101 tests

Re: [PATCH] libebl: Fix reading GNU_PROPERTY_STACK_SIZE reading from 32bit notes.

2018-12-05 Thread Mark Wielaard
On Mon, 2018-12-03 at 00:15 +0100, Mark Wielaard wrote: > When reading a GNU_PROPERTY_STACK_SIZE we need to use the proper data > type. GElf_Addr is 64bit always and when reading a 32bit size part of > it would not be initialized. Use either Elf32_Addr or Elf64_Addr to > read and pr

Re: dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs?

2019-01-06 Thread Mark Wielaard
On Fri, Dec 14, 2018 at 01:44:17PM +, Luke Diamand wrote: > On Thu, 13 Dec 2018 at 22:37, Roland McGrath wrote: > > > > I think it's just missing. The hardest part is just deciding how the > > configuration should work. > > Thanks. My current attempt adds a new function call, > dwfl_set_sysr

Re: RISC-V support

2019-01-08 Thread Mark Wielaard
Hi Jim, Apologies for the late reply, holiday season. Seeing some patches already posted I think you already found the answers to your questions, but just to be sure, lets answer this email before reviewing the actual patches. On Wed, 2018-12-26 at 18:29 -0800, Jim Wilson wrote: > I'm looking at

Re: [PATCH] RISC-V: Improve riscv64 core file support.

2019-01-08 Thread Mark Wielaard
On Thu, Dec 27, 2018 at 03:25:49PM -0800, Jim Wilson wrote: > This fixes two problems. The offset for x1 is changed from 1 to 8 because > this > is a byte offset not a register skip count. Support for reading the PC value > is added. This requires changing the testsuite to match the new readelf

Re: [PATCH] RISC-V: Add initial return value location support.

2019-01-10 Thread Mark Wielaard
On Thu, 2018-12-27 at 15:26 -0800, Jim Wilson wrote: > Started with the aarch64 support and modified it for RISC-V. The > flattened > structure support hasn't been written yet, but the rest of it should > be > correct for the LP64D ABI. We have potentially 6 different ABIs to > support, > so this

Re: [PATCH] RISC-V: Add untested 32-bit core file support.

2019-01-12 Thread Mark Wielaard
On Thu, 2018-12-27 at 15:27 -0800, Jim Wilson wrote: > This conflicts with the previoues two patches. Adds 32-bit support exactly > the > same way that the sparc backend handles 32- and 64-bit core file support. The > 64-bit core file support was tested and still works same as before. I don't r

Re: RISC-V support

2019-01-12 Thread Mark Wielaard
On Sat, 2019-01-12 at 00:23 +0100, Kurt Roeckx wrote: > I've been looking at mips, and it seems to have many different > ABIs too. A patch I've received does this: > int > mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op > **locp) > { > /* First find the ABI used by the elf obje

Re: [PATCH] RISC-V: Add untested 32-bit core file support.

2019-01-13 Thread Mark Wielaard
On Sat, Jan 12, 2019 at 04:37:51PM -0800, Jim Wilson wrote: > On Sat, Jan 12, 2019 at 2:29 PM Mark Wielaard wrote: > > > static const Ebl_Register_Location prstatus_regs[] = > > >{ > > > -{ .offset = 8, .regno = 1, .count = 31, .bits = 64 } /* x1..x31 */

Re: [PATCH] Skip run-readelf-compressed.sh test if built without bzip2

2019-01-13 Thread Mark Wielaard
On Wed, Jan 09, 2019 at 01:30:19PM +, Ulf Hermann wrote: > Obviously, we cannot read the compressed ELF file if no bzip2 support is > present. Added a ChangeLog and pushed to master. Please don't sent patches with base64 encoding. That make it really hard to apply them with git am. Thanks, M

[PATCH] libebl: Check NT_PLATFORM core notes contain a zero terminated string.

2019-01-16 Thread Mark Wielaard
Most strings in core notes are fixed size. But NT_PLATFORM contains just a variable length string. Check that it is actually zero terminated before passing to readelf to print. https://sourceware.org/bugzilla/show_bug.cgi?id=24089 Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog

Re: [PATCH] Skip run-readelf-compressed.sh test if built without bzip2

2019-01-16 Thread Mark Wielaard
On Mon, 2019-01-14 at 08:27 +, Ulf Hermann wrote: > > Added a ChangeLog and pushed to master. > > Please don't sent patches with base64 encoding. > > That make it really hard to apply them with git am. > > Thanks, and sorry. As the message in my "Sent" folder is plain text with > 7bit encodin

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

2019-01-18 Thread Mark Wielaard
the system installed elf.h. Add a new configure option --enable-install-elfh to install elf.h. But warn when it is enabled for the default /usr or /usr/local prefix because it might clash with the glibc/system elf.h header in that case. Signed-off-by: Mark Wielaard --- ChangeLog | 4

[PATCH] libdw: Check terminating NUL byte in dwarf_getsrclines for dir/file table.

2019-01-20 Thread Mark Wielaard
org/bugzilla/show_bug.cgi?id=24102 Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/dwarf_getsrclines.c | 11 --- src/ChangeLog | 5 + src/readelf.c | 8 ++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/li

[PATCH] libdwfl: Sanity check partial core file dyn data read.

2019-01-20 Thread Mark Wielaard
When reading the dyn data from the core file check if we got everything, or just part of the data. https://sourceware.org/bugzilla/show_bug.cgi?id=24103 Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog| 5 + libdwfl/dwfl_segment_report_module.c | 6 ++ 2 files

Re: MIPS Elfutils support?

2019-01-22 Thread Mark Wielaard
Hi Luke, On Sun, 2019-01-20 at 16:42 +, Luke Diamand wrote: > I was hoping to use elfutils on some MIPS core files. So I was > wondering what the status is? > > There is a patch in Debian (apparently originally from RedHat?) here: > https://sources.debian.org/src/elfutils/0.175-2/debian/patc

Re: [PATCH] Use separate files for strip outputs

2019-01-23 Thread Mark Wielaard
On Fri, Jan 18, 2019 at 12:56:28PM +, Ulf Hermann wrote: > Let's see if this works: Apparently I cannot get a properly formatted > inline diff through. Therefore, please find the pull request, including > diff, as attachment. That certainly works. git pull https://codereview.qt-project.org/q

Re: [PATCH] Use separate files for strip outputs

2019-01-24 Thread Mark Wielaard
On Wed, 2019-01-23 at 23:19 +0100, Mark Wielaard wrote: > As you say in your commit message this exposes that the > run-strip-test-many.sh actually fails. Indeed, even without > you patch you can see src/strip: illformed file 'testfile' > in the run-strip-test-many.sh.log

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

2019-01-24 Thread Mark Wielaard
(whether we are actually on a POSIX system or not). And I am not sure it really should define uid_t, gid_t, mode_t, and pid_t. Those normally don't come from features.h (they would come from sys/types.h). Cheers, Mark From 86f9481187bccb78b2533674bb905a0de1a03abf Mon Sep 17 00:00:00 2001

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

2019-01-29 Thread Mark Wielaard
Hi Luke, On Sun, Jan 20, 2019 at 03:00:42PM +, Luke Diamand wrote: > Following on from this discussion: > https://sourceware.org/ml/elfutils-devel/2018-q4/msg00224.html > > This patch adds a new API to specify a sysroot, and extends eu-stack to > use it with a new command line option. >

Re: [PATCHv2 1/2] libdwfl: specify optional sysroot to search for shared libraries

2019-01-29 Thread Mark Wielaard
On Tue, Jan 22, 2019 at 10:16:25AM +, Luke Diamand wrote: > When searching the list of modules in a core file, if the core was > generated on a different system to the current one, we need to look > in a sysroot for the various shared objects. > > For example, we might be looking at a core fil

Re: [PATCHv2 2/2] eu-stack: add support for sysroot option

2019-01-29 Thread Mark Wielaard
On Tue, Jan 22, 2019 at 10:16:26AM +, Luke Diamand wrote: > Use the dwfl_set_sysroot() function to set the sysroot to be > used when analysing a core: > > e.g. >$ eu-stack --core core --sysroot /path/to/sysroot -e crashing_prog > > Signed-off-by: Luke Diamand This looks perfect (but is

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

2019-01-29 Thread Mark Wielaard
Hi Ulf, On Thu, Jan 24, 2019 at 06:53:15PM +0100, Mark Wielaard wrote: > On Fri, 2019-01-18 at 14:03 +, Ulf Hermann wrote: > > I think you should also adapt tests/Makefile.am to use our own elf.h > > in > > this case. See https://codereview.qt-project.org/#/c

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