libabigail/default.abignore
Dodji Seketeli dbae53ec30 Bug 31646: Fix type suppression tactics for webkit2gtk3
By default, using abidw --abidiff on the binary
/usr/lib64/libwebkit2gtk-4.0.so.37 on the ppc64le platform takes more
than 50GB of RAM and ooms on my system.  That is why a number of
suppression specifications have been put in place in the
default.abignore file that is installed by default on the system.
With that suppression specification however, abidw --abidiff hits an
assert and crashes.

That is because the suppression specification rule below is too eager
and thus removes parameters from some function's signature, in the
final internal representation:

    [suppress_type]
      soname_regexp = libwebkit2?gtk-.*\\.so.*
      name_regexp = (^std::.*|WebCore::.*|WebKit::.*)
      drop = true

An example of function signature that got changed (in the IR) because
of this suppression specification is:

This function signature:

    WebKitAuthenticationScheme
    webkit_authentication_request_get_scheme(WebKitAuthenticationRequest*)

becomes (after applying the suppression specification above):

    void
    webkit_authentication_request_get_scheme()

Woops.  That is not good.

To address that problem, this patch changes that suppression
specification to make libabigail transform those types into opaque
types.  An opaque struct, class or enum is essentially a
declaration-only type of the same kind and name.

So the suppression specification above becomes:

    [suppress_type]
      # Drop all standard c++ types on the floor like before.
      soname_regexp = libwebkit2?gtk-.*\\.so.*
      name_regexp = ^std::.*
      drop = true

    [suppress_type]
      # Transform all C++ types in the WebCore and WebKit namespaces into
      # opaque types.  These are essentially internal types of libwebkit2
      # anyway.  This greatly reduces the size of the in-memory working set.
      label = libabigail::OPAQUE_TYPE_LABEL
      soname_regexp = libwebkit2?gtk-.*\\.so.*
      name_regexp = (WebCore::.*|WebKit::.*)
      drop = true

Notice the introduction of the new special label
"libabigail::OPAQUE_TYPE_LABEL".  This new special label is what makes
the suppression engine of libabigail transform a type (that matches
that suppression specification) into an opaque type, rather than
dropping it on the floor.

The patch then adapts the code of the suppression engine to detect
this special label for the purpose of transforming types into opaque
types.  The patch normalizes the use of the term "opaque type" instead
of "private type" that was used previously in the code.

The patch fixes a bug in the code of get_opaque_version_of_type that
prevents this function from working on types with no location
information.

While working on this, I have noticed that the abipkgdiff has a bug
that was making it ignore suppression specifications provided via the
--suppression option.  The patch fixes that.

I have noticed that abipkgdiff --self-check completely ignores all
suppression specifications provided either via --suppression or
indirectly via devel packages.  The patch fixes that.

Last but not least, fedabipkgdiff --self-compare completely ignores
suppression specifications too!  The patch fixes that as well.

With all those fixes, the system now takes around 7GB of RAM and ~ 30
minutes to complete the analysis of the webkit2gtk3 package, using a
non-optimized libabigail build.

The command I use is:

    $ time tools/fedabipkgdiff --debug --self-compare --abipkgdiff build/tools/abipkgdiff --suppressions default.abignore -a --from fc39 webkit2gtk3

    [...]

    [DEBUG] Result from run_abipkgdiff: 0, in: 0:29:00.088735
    [DEBUG] Result from self_compare_rpms_from_distro: 0, in: 0:29:20.721748

    real	29m20,846s
    user	29m4,561s
    sys	        2m41,611s
    $

The culprit package was webkit2gtk3-2.40.1-1.fc36.ppc64le.rpm.

To reproduce the issue on that package, I do:

    $ time ~/git/libabigail/rhbz2273891/build/tools/abipkgdiff --self-check --suppr ~/git/libabigail/rhbz2273891/default.abignore --d1 webkit2gtk3-debuginfo-2.40.1-1.fc36.ppc64le.rpm --devel1 webkit2gtk3-devel-2.40.1-1.fc36.ppc64le.rpm webkit2gtk3-2.40.1-1.fc36.ppc64le.rpm

    ==== SELF CHECK SUCCEEDED for 'libwebkit2gtk-4.0.so.37.63.2' ====
    ==== SELF CHECK SUCCEEDED for 'WebKitWebDriver' ====
    ==== SELF CHECK SUCCEEDED for 'WebKitNetworkProcess' ====
    ==== SELF CHECK SUCCEEDED for 'WebKitWebProcess' ====

    real	8m25,895s
    user	8m46,433s
    sys	        0m15,683s
    $

	* default.abignore: Split the libwebkit2gtk suppression
	specification for types whose names match the regexp
	^std::.*|WebCore::.*|WebKit::.* into two.  One that drops type
	with names being ^std::.* and another one that turns type being
	WebCore::.*|WebKit::.* into opaque types.
	* doc/manuals/libabigail-concepts.rst: Add documentation for the
	new special label libabigail::OPAQUE_TYPE_LABEL that transforms
	types matching a [suppress_type] into opaque types.
	* include/abg-suppression.h (is_opaque_type_suppr_spec): Renamed
	is_private_type_suppr_spec into this.
	(get_opaque_types_suppr_spec_label): Renamed
	get_private_types_suppr_spec_label.
	* src/abg-comparison.cc (diff::is_suppressed): Adjust.
	* src/abg-dwarf-reader.cc (type_is_suppressed): Adjust. Change the
	name of the type_is_private parameter into type_is_opaque.
	(get_opaque_version_of_type): Do not return early if the type has
	no associated location.  What was I thinking.
	(build_ir_node_from_die): For enums, struct and classes adjust
	call to type_is_suppressed.
	* src/abg-suppression.cc (type_suppression::suppresses_diff):
	Adjust to using is_opaque_type_suppr_spec and
	get_opaque_version_of_type in lieu of is_private_type_suppr_spec
	and get_private_types_suppr_spec_label.
	(get_opaque_types_suppr_spec_label): Rename
	get_private_types_suppr_spec_label into this.  Also, rename the
	name of the special label that specifies opaque types from
	"Artificial private types suppression specification" to
	"libabigail::OPAQUE_TYPE_LABEL".
	(is_opaque_type_suppr_spec): Rename is_private_type_suppr_spec
	into this.
	(is_type_suppressed): Rename the "type_is_private" parameter into
	"type_is_opaque".
	* src/abg-tools-utils.cc (handle_file_entry): Adjust to using
	get_opaque_types_suppr_spec_label rather than
	get_private_types_suppr_spec_label.
	* tools/abipkgdiff.cc (compare): Use the supprs variable where all
	the suppression specifications got accumulated, not just the
	priv_types_supprs1.
	(compare_to_self): Add a suppression specifications variable for
	private types.  Add those private types specs to the user-provided
	ones.
	* tools/fedabipkgdiff (abipkgdiff): In the self comparison mode,
	take into account devel packages and suppression specifications.
	Pass those to the abipkgdiff tool's invocation.
	* tests/data/test-diff-suppr/PR31646/test-PR31646-result-[1-3].txt:
	New reference test output files.
	* tests/data/test-diff-suppr/PR31646/test-PR31646-v{0,1}.cc:
	Source code of binary inputs below.
	* tests/data/test-diff-suppr/PR31646/test-PR31646-v{0,1}.o: Binary
	input files.
	* tests/data/test-diff-suppr/PR31646/test-PR31646.2.abignore:
	Suppression specification file.
	* tests/data/test-diff-suppr/PR31646/test-PR31646.abignore:
	Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
	to this harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2024-04-16 17:46:19 +02:00

196 lines
6.8 KiB
Plaintext

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# This file contains default system-wide suppression specifications to
# be used by Abigail tools[1] to filter out specific ABI change
# reports when comparing the ABI of some core system binaries.
#
# To learn about the syntax of Abigail suppression specifications,
# please refer to the relevant section of the online manual[2].
#
# If you feel like some suppression specifications should be added to
# this file so that they can be applied system-wide each time an
# Abigail tool is invoked to compare a given core system binary,
# please file an enhance request to
# https://sourceware.org/bugzilla/enter_bug.cgi?product=libabigail.
#
# Or, consider just adding those suppression specification to your
# ~/.abignore file.
#
# [1]: https://sourceware.org/libabigail/manual/libabigail-overview.html
# [2]: https://sourceware.org/libabigail/manual/libabigail-concepts.html#suppression-specifications.
#
#############################################
# Below are glibc suppression specifications
############################################
# The idea is to suppress ABI change reports on functions and variable
# which symbol version is "GLIBC_PRIVATE". The SONAMEs of the
# libraries these suppression specification are to be applied to are:
#
# ld-linux-x86-64.so.2
# libanl.so.1
# libcidn.so.1
# libcrypt.so.1
# libc.so.6
# libdl.so.2
# libm.so.6
# libmvec.so.1
# libnsl.so.1
# libnss_compat.so.2
# libnss_db.so.2
# libnss_dns.so.2
# libnss_files.so.2
# libnss_hesiod.so.2
# libnss_nisplus.so.2
# libnss_nis.so.2
# libpthread.so.0
# libresolv.so.2
# librt.so.1
# libthread_db.so.1
# libutil.so.1
#
# The SONAMEs above can be derived from
# https://sourceware.org/glibc/wiki/ABIList.
[suppress_function]
# Suppress ABI change reports about functions which symbol version
# is "GLIBC_PRIVATE"
symbol_version = GLIBC_PRIVATE
# And we want to restrict this suppression specification only to
# libraries with these SONAMEs:
soname_regexp = (libanl|libcidn|libcrypt|libc|libdl|libm|libmvec|libnsl|libnss_compat|libnss_db|libnss_dns|libnss_files|libnss_hesiod|libnss_nisplus|libnss_nis|libpthread|libresolv|librt|libthread_db|libutil|ld\[a-z0-9-\]*)\\.so\\.\[0-9\]*
[suppress_variable]
# Suppress ABI change reports about functions which symbol version
# is "GLIBC_PRIVATE"
symbol_version = GLIBC_PRIVATE
# And we want to restrict this suppression specification only to
# libraries with these SONAMEs:
soname_regexp = (libanl|libcidn|libcrypt|libc|libdl|libm|libmvec|libnsl|libnss_compat|libnss_db|libnss_dns|libnss_files|libnss_hesiod|libnss_nisplus|libnss_nis|libpthread|libresolv|librt|libthread_db|libutil|ld\[a-z0-9-\]*)\\.so\\.\[0-9\]*
#############################################
# End of glibc suppression specifications
############################################
###########################################################
# Below are suppression specifications for webkitgtk
###########################################################
[suppress_function]
soname_regexp = libwebkit2?gtk-.*\\.so.*
name_not_regexp = ^webkit_.*
drop = true
[suppress_variable]
soname_regexp = libwebkit2?gtk-.*\\.so.*
name_regexp = (^std::.*|WebCore::.*|WebKit::.*)
drop = true
[suppress_type]
soname_regexp = libwebkit2?gtk-.*\\.so.*
name_regexp = ^std::.*
drop = true
[suppress_type]
# Transform all C++ types in the WebCore and WebKit namespaces into
# opaque types. These are essentially internal types of libwebkit2
# anyway. This greatly reduces the size of the in-memory working set.
label = libabigail::OPAQUE_TYPE_LABEL
soname_regexp = libwebkit2?gtk-.*\\.so.*
name_regexp = (^WebCore::.*|^WebKit::.*)
drop = true
[suppress_type]
# All structs that don't start with either WebKit* or _WebKit are
# considered internal types and so are transform into opaque types.
# This helps to reduce the size of the in-memory working set further.
label = libabigail::OPAQUE_TYPE_LABEL
soname_regexp = libwebkit2?gtk-.*\\.so.*
type_kind = struct
name_not_regexp = ^_?WebKit.*
drop = true
#######################################################
# End of webkitgtk suppression specifications
#######################################################
########################################################
# Suppression specification for C++ libraries
# that are not libstdc++.so
########################################################
[suppress_function]
soname_not_regexp = libstdc\\+\\+\\.so.*
name_regexp = std::.*
drop = true
[suppress_variable]
soname_not_regexp = libstdc\\+\\+\\.so.*
name_regexp = std::.*
drop = true
########################################################
# End of suppression specification for C++ libraries
# that are not libstdc++.so
########################################################
########################################################
# Suppression specification for C++ libraries
# that are not Boost.
########################################################
[suppress_function]
soname_not_regexp = libboost_.*\\.so.*
name_regexp = boost::.*
drop = true
[suppress_variable]
soname_not_regexp = libboost_.*\\.so.*
name_regexp = boost::.*
drop = true
########################################################
# End of suppression specification for C++ libraries
# that are not Boost.
########################################################
###########################################################
# Do not compare the kernel.img file from the grub2 package
###########################################################
[suppress_file]
file_name_regexp = kernel\\.img
#####################################################################
# End of "Do not compare the kernel.img file from the grub2 package"
#####################################################################
##########################################
# krb5 default suppression specifications
#########################################
[suppress_function]
# Suppress ABI change reports about functions starting with the name
# krb5int_* in libraries named libkrb5<something>.so
soname_regexp = libkrb5.*\\.so.*
name_regexp = ^krb5int_.*
##########################################
# End of krb5 suppression specifications
#########################################
#############################################
# libvirt default suppression specifications
#############################################
[suppress_function]
# Suppress ABI change reports about functions with symbol version
# LIBVIRT_PRIVATE
symbol_version = LIBVIRT_PRIVATE
soname_regexp = libvirt\\.so.*
####################################################
# End of libvirt default suppression specifications
####################################################