Bug 24188 - Assertion failed while analysing a Fortran binary

While analysing a Fortran binary the DWARF reader performs DIE
de-duplication.  During that process, the compare_dies function
stumbles accross the a DIE of the DW_TAG_string_type kind.  And it
doesn't know how to compare those DIEs.  And this leads to an abort of
the abipkgdiff program, in particular.

DW_TAG_string_type DIEs do have a DW_AT_string_length attribute which
value is a location expression that does not resolve to a constant
value.  In general, we cannot evaluate those expressions in a static
context like in Libabigail because we lack things like register values
which are dynamic in nature.

So, I decided for now to consider that two DW_TAG_string_type seen at
different DWARF offsets are considered to be different for now.  This
pessimises DIEs de-duplication for types that contain
DW_TAG_string_type as their subtypes, but at least this is a basic
support for DW_TAG_string_type.

Tested with the RPMs on which abipkgdiff was failing.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

	* src/abg-dwarf-reader.cc (compare_as_type_dies): Handle
	DW_TAG_string_type DIEs here.
	(compare_dies): Handle DW_TAG_string_type DIEs by using
	compare_as_type_dies.
	* tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm:
	New test RPM.
	* tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt:
	New expected test reference output.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm:
	New test RPM.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm:
	Likewise.
	* tests/data/Makefile.am: Add the new test input material above to
	source distribution.
	* tests/test-diff-pkg.cc (in_out_spec): Add the new test RPMs
	above to the set of RPMs to use as test input.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2019-02-08 09:48:40 +01:00
parent 84ec784743
commit c00e2120b9
12 changed files with 34 additions and 1 deletions

View File

@ -11406,6 +11406,16 @@ compare_as_type_dies(Dwarf_Die *l, Dwarf_Die *r)
ABG_ASSERT(die_is_type(l));
ABG_ASSERT(die_is_type(r));
if (dwarf_tag(l) == DW_TAG_string_type
&& dwarf_tag(r) == DW_TAG_string_type
&& dwarf_dieoffset(l) != dwarf_dieoffset(r))
// For now, we cannot compare DW_TAG_string_type because of its
// string_length attribute that is a location descriptor that is
// not necessarily a constant. So it's super hard to evaluate it
// in a libabigail context. So for now, we just say that all
// DW_TAG_string_type DIEs are different, by default.
return false;
uint64_t l_size = 0, r_size = 0;
die_size_in_bits(l, l_size);
die_size_in_bits(r, r_size);
@ -11475,6 +11485,7 @@ compare_dies(const read_context& ctxt, Dwarf_Die *l, Dwarf_Die *r,
switch (l_tag)
{
case DW_TAG_base_type:
case DW_TAG_string_type:
if (!compare_as_type_dies(l, r)
|| !compare_as_decl_dies(l, r))
result = false;
@ -11821,7 +11832,6 @@ compare_dies(const read_context& ctxt, Dwarf_Die *l, Dwarf_Die *r,
case DW_TAG_compile_unit:
case DW_TAG_namespace:
case DW_TAG_module:
case DW_TAG_string_type:
case DW_TAG_constant:
case DW_TAG_partial_unit:
case DW_TAG_imported_unit:

View File

@ -1452,6 +1452,15 @@ test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm \
test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm \
test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm \
test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm \
test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm \
test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm \
test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt \
\
test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm \
test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm \

View File

@ -577,6 +577,20 @@ static InOutSpec in_out_specs[] =
"data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt",
"output/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm,"
"data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm,"
"data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt",
"output/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt"
},
#endif //WITH_RPM
#ifdef WITH_DEB