Re: [PATCH] libdw: Add dwarf_next_lines to read .debug_line tables without CUs.

2018-06-29 Thread Mark Wielaard
On Mon, 2018-06-25 at 15:12 +0200, Mark Wielaard wrote:
> It is sometimes useful to read .debug_line tables on their own without
> having an associated CU DIE. DWARF5 line tables are self-contained.
> 
> Adjust dwarf_begin_elf to accept ELF files with just a .debug_line.
> 
> Add a new function dwarf_next_lines that returns the Dwarf_Files and
> Dwarf_Lines while iterating over just the .debug_lines section. Since
> we parse and cache the information it also will try to match the CU
> a table is associated with. This is only necessary for DWARF4 line
> tables (we will need at least the compilation dir from the CU) and
> won't be done for DWARF5 line tables. It also isn't an error if there
> is no associated CU (but will mean for DWARF4 line tables the dir list
> and the file paths might not be complete).
> 
> A typical way to call this new function is:
> 
>   Dwarf_Off off, next_off = 0;
>   Dwarf_CU *cu = NULL;
>   Dwarf_Files *files;
>   size_t nfiles;
>   Dwarf_Lines *lines;
>   size_t nlines;
>   int res;
>   while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu,
>   &files, &nfiles, &lines, &nlines)) == 0)
> {
>   /* ... handle files and lines ... */
> }
> 
>   if (res < 0)
> printf ("BAD dwarf_next_lines: %s\n", dwarf_errmsg (-1));
> 
> See libdw.h for the full documentation. For more examples on how to use
> the function see the new testcases next-files and next-lines.
> 
> Also adjust the file paths for line tables missing a comp_dir.
> They are no longer made "absolute" by prepending a slash '/' in front
> of them. This really was not useful and didn't happen in any of the
> testcases. They are now just kept relative.
> 
> Make eu-readelf --debug-dump=decodedline use dwarf_next_lines instead
> of iterating over the CUs to show the (decoded) line tables. This allows
> it to show decoded line tables even if there is no .debug_info section.
> 
> New tests have been added that mimic the get-files and get-lines tests
> but use dwarf_next_lines instead of iterating over all CUs. They produce
> identical output (modulo the CU information). Also add a new test file
> that contains only a .debug_line section.

Initial testing seems to indicate that it works as expected.
Pushed to git master.

Cheers,

Mark


Re: [PATCH] libdw: Remove dwarf_getscn_info from libdw.h and libdw.map.

2018-06-29 Thread Mark Wielaard
On Tue, 2018-06-26 at 16:45 +0200, Mark Wielaard wrote:
> This function was never actually implemented/provided by libdw.
> And it doesn't look like something we really want to implement.

Pushed to master.


Re: [PATCH] tests: Limit varlocs print_expr_block recursion depth.

2018-06-29 Thread Mark Wielaard
On Tue, 2018-06-26 at 16:50 +0200, Mark Wielaard wrote:
> This is only useful for bad DWARF where an expression block might have
> an expression that refers to a DIE that contains the expression block
> itself. But that might happen with bad DWARF generated by a fuzzer.

Pushed to master.


Re: [PATCH] libdw: Allow .debug_frame only Dwarf.

2018-06-29 Thread Mark Wielaard
On Wed, Jun 27, 2018 at 03:00:08PM +0200, Mark Wielaard wrote:
> .debug_frame is useful independent from the other .debug sections.
> 
> Add a simplified variant of the addrcfi testcase dwarfcfi.
> dwarfcfi only uses dwarf_frame calls and no dwfl helpers.

Pushed to master.


Re: [PATCH] libdw: Recognize zero terminator to end frame table in dwarf_next_cfi.

2018-06-29 Thread Mark Wielaard
On Fri, Jun 29, 2018 at 12:26:30AM +0200, Mark Wielaard wrote:
> When the length is zero this is a the zero terminator that ends the
> frame table. Return 1 (end of table) instead of -1 (error) in that case.
> We cannot update next_off and don't want to caller to try again.
> 
> Add testcase for dwarf_next_cfi to show both .eh_frame and .debug_frame
> tables and check consistency (FDEs should point to existing CIEs).
> Also add a self check to make sure we can read the table from the just
> build elfutils binaries.

Pushed to master.


[COMMITTED] Prepare for 0.173

2018-06-29 Thread Mark Wielaard
Set version to 0.173.
Mention new functionality in NEWS.
Update po/*.po files.

Signed-off-by: Mark Wielaard 
---
 NEWS|  18 +++
 config/elfutils.spec.in |  15 ++
 configure.ac|   2 +-
 po/de.po| 317 
 po/es.po| 317 
 po/ja.po| 317 
 po/pl.po| 317 
 po/uk.po| 317 
 8 files changed, 829 insertions(+), 791 deletions(-)

diff --git a/NEWS b/NEWS
index 2b7f442e..065e995c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Version 0.173
+
+More fixes for crashes and hangs found by afl-fuzz. In particular various
+functions now detect and break infinite loops caused by bad DIE tree cycles.
+
+readelf: Will now lookup the size and signedness of constant value types
+ to display them correctly (and not just how they were encoded).
+
+libdw: New function dwarf_next_lines to read CU-less .debug_line data.
+   dwarf_begin_elf now accepts ELF files containing just .debug_line
+   or .debug_frame sections (which can be read without needing a DIE
+   tree from the .debug_info section).
+   Removed dwarf_getscn_info, which was never implemented.
+
+backends: Handle BPF simple relocations.
+  The RISCV backends now handles ABI specific CFI and knows about
+  RISCV register types and names.
+
 Version 0.172
 
 No functional changes compared to 0.171.
diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in
index 8e41f46a..b64cc287 100644
--- a/config/elfutils.spec.in
+++ b/config/elfutils.spec.in
@@ -227,6 +227,21 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_sysctldir}/10-default-yama-scope.conf
 
 %changelog
+* Fri Jun 29 2018 Mark Wielaard,,,  0.173-1
+- More fixes for crashes and hangs found by afl-fuzz. In particular
+  various functions now detect and break infinite loops caused by bad
+  DIE tree cycles.
+- readelf: Will now lookup the size and signedness of constant value
+  types to display them correctly (and not just how they were encoded).
+- libdw: New function dwarf_next_lines to read CU-less .debug_line data.
+  dwarf_begin_elf now accepts ELF files containing just .debug_line
+  or .debug_frame sections (which can be read without needing a DIE
+  tree from the .debug_info section).
+  Removed dwarf_getscn_info, which was never implemented.
+- backends: Handle BPF simple relocations.
+  The RISCV backends now handles ABI specific CFI and knows about
+  RISCV register types and names.
+
 * Mon Jun 11 2018 Mark Wielaard  0.172-1
 - No functional changes compared to 0.171.
 - Various bug fixes in libdw and eu-readelf dealing with bad DWARF5
diff --git a/configure.ac b/configure.ac
index 0ee16df0..1cf6245b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl  GNU General Public License for more details.
 dnl
 dnl  You should have received a copy of the GNU General Public License
 dnl  along with this program.  If not, see .
-AC_INIT([elfutils],[0.172],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
+AC_INIT([elfutils],[0.173],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
 
 dnl Workaround for older autoconf < 2.64
 m4_ifndef([AC_PACKAGE_URL],
-- 
2.17.1



elfutils 0.173 released

2018-06-29 Thread Mark Wielaard
ELFUTILS 0.173 - http://elfutils.org/

A new release of elfutils is available at:
ftp://sourceware.org/pub/elfutils/0.173/
or https://sourceware.org/elfutils/ftp/0.173/

* NEWS *

More fixes for crashes and hangs found by afl-fuzz. In particular various
functions now detect and break infinite loops caused by bad DIE tree cycles.

readelf: Will now lookup the size and signedness of constant value types
 to display them correctly (and not just how they were encoded).

libdw: New function dwarf_next_lines to read CU-less .debug_line data.
   dwarf_begin_elf now accepts ELF files containing just .debug_line
   or .debug_frame sections (which can be read without needing a DIE
   tree from the .debug_info section).
   Removed dwarf_getscn_info, which was never implemented.

backends: Handle BPF simple relocations.
  The RISCV backends now handles ABI specific CFI and knows about
  RISCV register types and names.

* GIT SHORTLOG *

Andreas Schwab (1):
  backends: add abi_cfi and register_info callbacks for RISC-V

Luiz Angelo Daros de Luca (1):
  libdw: Initialize filelist earlier in dwarf_getsrclines.c read_srclines.

Mark Wielaard (18):
  readelf: Handle signedness of DW_FORM_implicit_const and DW_AT_const_value.
  readelf: While printing .debug_loc make sure that next_off doesn't overflow.
  libdw: Make __libdw_dieabbrev more robust on failure.
  readelf: Make sure print_form_data always consumes DW_FORM_strx[1234] data.
  readelf: Check there are at least 4 bytes available for DWARF_FORM_block4.
  libdw, readelf: Don't handle DW_FORM_data16 as expression block/location.
  libdw: aggregate_size check NULL result from get_type.
  libdw: dwarf_peel_type break long chains/cycles.
  libdw: Break dwarf_aggregate_size recursion because of type cycles.
  libelf: Sync elf.h from glibc.
  libelf: Don't return unaligned data returned from elf_getdata[_rawchunk].
  libdw: Handle bogus CU length in dwarf_nextcu.
  libdw: Add dwarf_next_lines to read .debug_line tables without CUs.
  tests: Limit varlocs print_expr_block recursion depth.
  libdw: Remove dwarf_getscn_info from libdw.h and libdw.map.
  libdw: Allow .debug_frame only Dwarf.
  libdw: Recognize zero terminator to end frame table in dwarf_next_cfi.
  Prepare for 0.173

Yonghong Song (1):
  backends,bpf: add proper relocation support



signature.asc
Description: PGP signature


dependency

2018-06-29 Thread Sasha Da Rocha Pinheiro
Hi,
is there a reference for the last stable version of Elfutils? 

Currently we set the following path in our cmake configuration to download and 
compile Elfutils as a dependency for Dyninst, but lately there has been some 
important modifications, and I think it would be nice to have a reference to a 
stable version so we don't need to check for new versions and update our make 
files.

https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2


Sasha

Re: dependency

2018-06-29 Thread Frank Ch. Eigler
Hi -

> is there a reference for the last stable version of Elfutils? 
> [...]
> https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2

Each elfutils release is "stable".  Are you looking for
a fixed URL for the most recent release?


- FChE


Re: dependency

2018-06-29 Thread Sasha Da Rocha Pinheiro
> Each elfutils release is "stable".  Are you looking for
> a fixed URL for the most recent release?

Yes, that's what I meant.

Sasha

 
From: Frank Ch. Eigler 
Sent: Friday, June 29, 2018 8:12 PM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: dependency
  

Hi -

> is there a reference for the last stable version of Elfutils? 
> [...]
> https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2

Each elfutils release is "stable".  Are you looking for
a fixed URL for the most recent release?


- FChE


Re: dependency

2018-06-29 Thread Mark Wielaard
On Sat, 2018-06-30 at 00:49 +, Sasha Da Rocha Pinheiro wrote:
> Hi,
> is there a reference for the last stable version of Elfutils? 
> 
> Currently we set the following path in our cmake configuration to
> download and compile Elfutils as a dependency for Dyninst, but lately
> there has been some important modifications, and I think it would be
> nice to have a reference to a stable version so we don't need to
> check for new versions and update our make files.

We could certainly add some symlink(s) to the "latest" stable/released
version that is updated whenever we do a release.

What kind of naming/link is the most convenient?

Should it just be a link to the latest release dir?
https://sourceware.org/elfutils/ftp/latest/
-> https://sourceware.org/elfutils/ftp/0.172/

Or would a direct link to the source tar ball and signature file be
better?

https://sourceware.org/elfutils/ftp/latest/elfutils-latest.tar.bz2
-> https://sourceware.org/elfutils/ftp/0.172/elfutils-0.172.tar.bz2
https://sourceware.org/elfutils/ftp/latest/elfutils-latest.tar.bz2.sig
-> https://sourceware.org/elfutils/ftp/0.172/elfutils-0.172.tar.bz2.sig

Or some other scheme?

We could also have the buildbot create a "latest" or "current" from git
once all builds are green for example.

Which brings up the question, should we use "stable", "current" or
"latest" as link name, or is there a better, more standard name to use
for that? What do other projects use?

Thanks,

Mark