The Git repository of the Libabigail Project
Go to file
Dodji Seketeli 2f038ab3d4 Bug 31236 - Fix removing a member declaration from its scope
In some C++ binaries, DWARF can represent a member variable using a
global variable /definition/ DIE not having a reference attribute
pointing back to the member variable declaration DIE.  The only way we
know that the global variable is a definition DIE for a member
variable is because its linkage name demangles to
"foo::bar::var_name", with foo::bar being a class name.

So, for each translation unit, when the DWARF reader reads a global
variable DIE, it builds a variable IR node for it and stashes it on
the side.

Then, when the translation unit is built, the DWARF reader looks at
all the stashed global variables, detects those that are actually
member variables and adds them to their class.  But then, before
adding a (former global) variable to its class, the reader has first
to remove it from its global scope.  This removal is done by the
function remove_decl_from_scope, which calls
scope_decl::remove_member_decl.

The issue here is that remove_decl_from_scope forgets to unset the
translation unit property of the global variable.

Then, in the particular case of this problem report, when
scope_decl::add_member_decl is called to add the variable to its
class, it detects that the variable belongs to /another/ translation
unit and (rightfully) aborts.  Ooops.

This patch fixes the issue by making remove_decl_from_scope remove the
variable from its translation unit too, not just from its scope.  The
patch actually delegates the scope & translation unit resetting to
scope_decl::remove_member_decl because it appears to me that this is
where these ought to be handled.

To ensure that the issue is fixed, one needs to unpack the package
webkit2gtk3-2.40.5-1.el9_3.1.x86_64.rpm and run abidw on the binary
$prefix/usr/lib64/libwebkit2gtk-4.0.so.37 like:

   $ abidw --noout $prefix/usr/lib64/libwebkit2gtk-4.0.so.37

Given the size of the library, this takes three hours and a half as
well as ~50GB of ram to complete on my system using a non-optimized
debug build of libabigail.  We definitely need to invest in more speed
optimizations to handle webkit.  That would be for another day, I
guess.

	* src/abg-ir.cc (scope_decl::remove_member_decl): Reset the
	translation unit and the scope of the removed decl.
	(remove_decl_from_scope): Do not reset the scope of the removed
	decl here as it's now done above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2024-01-16 09:38:37 +01:00
.github Adding missing newline to build-container workflow 2022-05-17 09:46:16 +02:00
autoconf-archive Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
bash-completion Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
doc website: doxygen: set PROJECT_NAME to libabigail 2024-01-08 09:31:34 -05:00
docker Add github actions to support workflows 2022-05-17 00:13:40 +02:00
include Bug 30260 - Support pointer-to-member type 2023-12-01 15:43:53 +01:00
m4 Delete ltsugar.m4 and pkg.m4 files from m4/ 2015-01-06 09:54:45 +01:00
relicensing-scripts Bug 27512 - Remove broken zip-archive support 2021-03-19 10:52:57 +01:00
scripts Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
src Bug 31236 - Fix removing a member declaration from its scope 2024-01-16 09:38:37 +01:00
tests Bump abixml version to 2.3 2023-12-01 15:43:53 +01:00
tools abilint: Alphabetically sort programs options 2023-12-01 15:43:41 +01:00
.clang-format Tweak clang-format configuration 2021-10-19 12:59:18 +02:00
.gitignore .gitignore: Add libabigail-?.* *.orig files 2019-05-22 14:34:23 +02:00
.mailmap Add '.mailmap' 2021-12-17 20:12:20 +01:00
abigail.m4 Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
ABIXML-FORMAT-VERSIONS Bug 28450 - Fix cloned member function handling in DWARF 2021-11-12 18:31:28 +01:00
AUTHORS Initial AUTHORS and README 2013-02-28 13:25:20 +01:00
ChangeLog ChangeLog: Update for 2.4 release 2023-10-20 18:40:33 +02:00
COMMIT-LOG-GUIDELINES Update the COMMIT-LOG-GUIDELINES file 2016-05-22 23:20:12 +02:00
COMPILING Improve some grammar 2022-02-25 11:24:20 +01:00
configure.ac Recognize EM_RISCV in e_machine_to_string 2024-01-08 16:02:18 +01:00
CONTRIBUTING Improve some grammar 2022-02-25 11:24:20 +01:00
default.abignore Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
gen-changelog.py gen-changelog.py: Remove long standing debugging output 2023-10-20 18:35:59 +02:00
install-sh Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
libabigail.pc.in Make libxml2 a private dependency wrt pkconfig 2013-08-22 17:41:29 +02:00
license-change-2020.txt Add a license-change-2020.txt file 2020-12-02 11:50:22 +01:00
LICENSE.txt Add the LICENSE.txt file 2020-12-02 11:49:33 +01:00
ltmain.sh Replace individual license references with SPDX Identifiers 2020-12-02 11:44:13 +01:00
Makefile.am Use xz as the default tarball compression format 2022-11-18 13:06:09 +01:00
NEWS Update NEWS file for 2.4 release 2023-10-20 18:40:33 +02:00
README Improve some grammar 2022-02-25 11:24:20 +01:00
README-DOCKER.md Add github actions to support workflows 2022-05-17 00:13:40 +02:00
release-text-template.txt release-text-template.txt: Modernize a little bit. 2023-05-10 16:29:55 +02:00
update-copyright.sh Update copyright year for 2023 2023-01-01 18:19:30 +01:00
VISIBILITY Improve some grammar 2022-02-25 11:24:20 +01:00

This is the Application Binary Interface Generic Analysis and
Instrumentation Library.

It aims at constructing, manipulating, serializing and de-serializing
ABI-relevant artifacts.

The set of artifacts that we are intersted is made of quantities like
types, variable, functions and declarations of a given library or
program.  For a given library or program this set of quantities is
called an ABI corpus.

This library aims at (among other things) providing a way to compare
two ABI Corpora (apparently the plural of corpus is copora, heh,
that's cool), provide detailed information about their differences,
and help build tools to infer interesting conclusions about these
differences.

You are welcome to contribute to this project after reading the files
CONTRIBUTING and COMMIT-LOG-GUIDELINES files in the source tree.

Communicating with the maintainers of this project -- including
sending patches to be include to the source code -- happens via email
at libabigail@sourceware.org.