public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Cc: dodji@redhat.com
Subject: [PATCH 0/4] Support undefined interfaces to fix abicompt's weak mode
Date: Thu, 14 Mar 2024 17:54:15 +0100	[thread overview]
Message-ID: <87ttl83gaw.fsf@redhat.com> (raw)

Hello,

The weak mode of operation of the 'abicompat' tool is a mode where
only one version of the library is needed for the tool to detect
incompatibilities between the interfaces expected by the application
and the interfaces provided by a library.

In this weak mode, the 'abicompat' tool first looks at the undefined
symbols of the application.  For each of these symbols that are
defined by the library, the tool 'synthesizes' (okay, it actually
'guesses') the type of the interface as expected by the application.  Then
the tool compares the interface type expected by the application
against the interface type provided by the library.  If that
comparison yields meaningful changes, the tool reports those changes
as being potential ABI incompatibilities between the application and
the library.

The problem in this approach is that the accuracy of the type
comparison depends on the quality of the "guess" (aka synthesis) of
the type of the undefined interface in the application.  Today, that
guess often results in the signature of the expected interface being
similar to the signature of the provided one, leading to many false
negative results.

Rather than guessing, this patch series proposes to use the DWARF
representation of the undefined interfaces (in the application) to
determine its exact intermediate representation and thus completely
eliminate the previous false negatives.

To achieve that goal, the first patch models undefined functions and
variables in the ABI corpus representation.  These are functions and
variables whose associated ELF symbols are undefined.  In other words,
these undefined interfaces represent the interfaces that are expected
by the ABI corpus.  This is done for the DWARF and CTF front-ends.
The abicompat tool is adjusted in a such a way that its weak mode of
operation is revisited to compare the undefined interfaces expected by
the application against the defined interfaces provided by the
library.  The weak mode is extended to also detect incompatibilities
between the interfaces expected by the library (in case it's a plugin)
and those provided by the application; this is called "bi-directional"
incompatibility detection.

The second patch of the series is a somewhat generic code
factorization that prepares the third patch.

The third patch adds support for the construction of these undefined
interfaces for the BTF front-end as well.

The fourth and last patch adds support to serialize and de-serialize
undefined interfaces to and from the ABIXML format.

Dodji Seketeli (4):
  Represent undefined corpus interfaces to analyze app compatibility
  Factorize elf-reader::{variable,function}_symbol_is_exported into symtab
  Add support for undefined symbols in the BTF reader
  Emit & read undefined interfaces to & from ABIXML

 doc/manuals/abicompat.rst                     |     5 +
 doc/manuals/abidw.rst                         |    10 +
 include/abg-corpus.h                          |    31 +-
 include/abg-elf-reader.h                      |     6 +
 include/abg-fe-iface.h                        |     8 +-
 include/abg-writer.h                          |     4 +
 ...-undefined-interfaces-to-from-ABIXML.patch |  1051 +
 src/abg-btf-reader.cc                         |    25 +-
 src/abg-corpus-priv.h                         |     6 +-
 src/abg-corpus.cc                             |   165 +-
 src/abg-ctf-reader.cc                         |     6 +-
 src/abg-dwarf-reader.cc                       |   372 +-
 src/abg-elf-reader.cc                         |    78 +-
 src/abg-fe-iface.cc                           |    43 +-
 src/abg-ir.cc                                 |    24 +-
 src/abg-reader.cc                             |    91 +-
 src/abg-symtab-reader.cc                      |   216 +-
 src/abg-symtab-reader.h                       |    35 +
 src/abg-writer.cc                             |   152 +-
 tests/data/Makefile.am                        |    25 +-
 .../libtest5-fn-changed-libapp-v0.so          |   Bin 9611 -> 18112 bytes
 .../libtest5-fn-changed-libapp-v1.so          |   Bin 9587 -> 18080 bytes
 .../test-abicompat/libtest6-undefined-var.so  |   Bin 0 -> 17688 bytes
 .../libtest6-var-changed-libapp-v0.so         |   Bin 9486 -> 17976 bytes
 .../libtest6-var-changed-libapp-v1.so         |   Bin 9462 -> 17984 bytes
 .../libtest7-fn-changed-libapp-btf-v0.so      |   Bin 0 -> 16560 bytes
 .../libtest7-fn-changed-libapp-btf-v1.so      |   Bin 0 -> 16584 bytes
 .../libtest7-fn-changed-libapp-v0.so          |   Bin 9438 -> 17968 bytes
 .../libtest7-fn-changed-libapp-v1.so          |   Bin 9462 -> 17992 bytes
 .../libtest8-fn-changed-libapp-v0.so          |   Bin 8940 -> 17376 bytes
 .../libtest8-fn-changed-libapp-v1.so          |   Bin 8972 -> 17416 bytes
 .../test-abicompat/libtest9-fn-changed-v0.so  |   Bin 9004 -> 17456 bytes
 .../test-abicompat/libtest9-fn-changed-v1.so  |   Bin 9036 -> 17488 bytes
 .../test10/libtest10-with-exported-symbols.so |   Bin 0 -> 18288 bytes
 ...st10-with-incompatible-exported-symbols.so |   Bin 0 -> 18336 bytes
 ...-with-incompatible-exported-symbols.so.abi |    65 +
 .../test10/test10-app-with-undefined-symbols  |   Bin 0 -> 26072 bytes
 .../test10-app-with-undefined-symbols.abi     |    55 +
 .../test10-app-with-undefined-symbols.cc      |    13 +
 .../test10/test10-fn-changed-report-0.txt     |     0
 .../test10/test10-fn-changed-report-1.txt     |    13 +
 .../test10/test10-fn-changed-report-2.txt     |    13 +
 .../test10/test10-fn-changed-report-3.txt     |    13 +
 .../test10/test10-fn-changed-report-4.txt     |    13 +
 .../test10/test10-with-exported-symbols.cc    |    20 +
 .../test10/test10-with-exported-symbols.h     |    14 +
 ...st10-with-incompatible-exported-symbols.cc |    20 +
 ...est10-with-incompatible-exported-symbols.h |    14 +
 .../data/test-abicompat/test5-fn-changed-app  |   Bin 9881 -> 26040 bytes
 .../test-abicompat/test6-undefined-var.cc     |    12 +
 .../data/test-abicompat/test6-var-changed-app |   Bin 9822 -> 0 bytes
 .../test-abicompat/test6-var-changed-app.cc   |    15 -
 .../test6-var-changed-libapp-v0.cc            |     1 +
 .../test6-var-changed-libapp-v1.cc            |     1 +
 .../test6-var-changed-report-0.txt            |     2 +-
 .../test6-var-changed-report-1.txt            |     2 +-
 .../test6-var-changed-report-2.txt            |    15 +
 .../data/test-abicompat/test7-fn-changed-app  |   Bin 9938 -> 26008 bytes
 .../test-abicompat/test7-fn-changed-app.btf   |   Bin 0 -> 17536 bytes
 .../test-abicompat/test7-fn-changed-app.c     |     2 +
 .../test7-fn-changed-libapp-v0.c              |     2 +
 .../test7-fn-changed-libapp-v1.c              |     3 +
 .../test7-fn-changed-report-0.1.txt           |    19 +
 .../test7-fn-changed-report-1.txt             |     5 +
 .../test7-fn-changed-report-2.1.txt           |    16 +
 .../test7-fn-changed-report-2.txt             |     5 +
 .../data/test-abicompat/test8-fn-changed-app  |   Bin 9700 -> 25864 bytes
 .../test8-fn-changed-libapp-v1.c              |     2 +-
 .../data/test-abicompat/test9-fn-changed-app  |   Bin 10035 -> 26008 bytes
 .../test-abicompat/test9-fn-changed-app.cc    |     2 +-
 tests/data/test-annotate/libtest23.so.abi     |   711 +-
 .../test-annotate/libtest24-drop-fns-2.so.abi |   576 -
 .../test-annotate/libtest24-drop-fns.so.abi   |   576 -
 tests/data/test-annotate/test1.abi            |    74 +-
 .../data/test-annotate/test14-pr18893.so.abi  | 14336 +---
 .../data/test-annotate/test15-pr18892.so.abi  | 25174 ++-----
 .../data/test-annotate/test17-pr19027.so.abi  | 18027 +----
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 30166 +++-----
 ...19-pr19023-libtcmalloc_and_profiler.so.abi | 27423 ++-----
 tests/data/test-annotate/test2.so.abi         |    36 -
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 28876 ++------
 .../data/test-annotate/test21-pr19092.so.abi  |  4308 +-
 .../test8-qualified-this-pointer.so.abi       |    21 +-
 ...bus-glib-0.104-3.fc23.armv7hl-report-0.txt |     7 +-
 ...libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt |     6 +-
 ...0-from-fc20-to-fc23-dbus-glib-report-0.txt |     7 -
 ....fc20--dbus-glib-0.106-1.fc23-report-0.txt |     7 -
 ...--dbus-glib-0.106-1.fc23.i686-report-0.txt |     7 -
 ...-vte291-0.39.90-1.fc22.x86_64-report-0.txt |    13 +-
 .../PR22015-libboost_iostreams.so.abi         |  2466 +-
 .../test-read-dwarf/PR22122-libftdc.so.abi    |  3425 +-
 .../test-read-dwarf/PR26261/PR26261-exe.abi   |    42 +-
 tests/data/test-read-dwarf/libtest23.so.abi   |   411 +-
 .../libtest24-drop-fns-2.so.abi               |   321 -
 .../test-read-dwarf/libtest24-drop-fns.so.abi |   321 -
 .../test-read-dwarf/test-libaaudio.so.abi     |  1398 +-
 .../test-read-dwarf/test-libandroid.so.abi    | 38724 ++++------
 tests/data/test-read-dwarf/test1.abi          |    54 +-
 tests/data/test-read-dwarf/test1.hash.abi     |    32 -
 .../test-read-dwarf/test10-pr18818-gcc.so.abi |  4340 +-
 .../test-read-dwarf/test11-pr18828.so.abi     |  8812 +--
 .../test-read-dwarf/test12-pr18844.so.abi     | 17781 +----
 .../test-read-dwarf/test14-pr18893.so.abi     |  7500 +-
 .../test-read-dwarf/test15-pr18892.so.abi     | 20419 ++----
 .../test-read-dwarf/test16-pr18904.so.abi     |  6042 +-
 .../test-read-dwarf/test17-pr19027.so.abi     | 13682 +---
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 18170 ++---
 ...19-pr19023-libtcmalloc_and_profiler.so.abi | 19957 ++----
 tests/data/test-read-dwarf/test2.so.abi       |    24 -
 tests/data/test-read-dwarf/test2.so.hash.abi  |    24 -
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 17154 +----
 .../test-read-dwarf/test21-pr19092.so.abi     |  3232 +-
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 59856 +++++-----------
 .../test8-qualified-this-pointer.so.abi       |    18 +-
 .../test8-qualified-this-pointer.so.hash.abi  |     6 -
 .../test9-pr18818-clang.so.abi                |  3052 +-
 tests/test-abicompat.cc                       |    89 +-
 tests/test-annotate.cc                        |     2 +-
 tests/test-read-common.cc                     |     1 +
 tests/test-read-ctf.cc                        |     2 +-
 tests/test-read-dwarf.cc                      |     2 +-
 tests/test-symtab.cc                          |    48 +-
 tools/abicompat.cc                            |   576 +-
 tools/abidw.cc                                |     7 +
 124 files changed, 104678 insertions(+), 296373 deletions(-)
 create mode 100644 patches/0001-WIP-Emit-read-undefined-interfaces-to-from-ABIXML.patch
 create mode 100755 tests/data/test-abicompat/libtest6-undefined-var.so
 create mode 100755 tests/data/test-abicompat/libtest7-fn-changed-libapp-btf-v0.so
 create mode 100755 tests/data/test-abicompat/libtest7-fn-changed-libapp-btf-v1.so
 create mode 100755 tests/data/test-abicompat/test10/libtest10-with-exported-symbols.so
 create mode 100755 tests/data/test-abicompat/test10/libtest10-with-incompatible-exported-symbols.so
 create mode 100644 tests/data/test-abicompat/test10/libtest10-with-incompatible-exported-symbols.so.abi
 create mode 100755 tests/data/test-abicompat/test10/test10-app-with-undefined-symbols
 create mode 100644 tests/data/test-abicompat/test10/test10-app-with-undefined-symbols.abi
 create mode 100644 tests/data/test-abicompat/test10/test10-app-with-undefined-symbols.cc
 create mode 100644 tests/data/test-abicompat/test10/test10-fn-changed-report-0.txt
 create mode 100644 tests/data/test-abicompat/test10/test10-fn-changed-report-1.txt
 create mode 100644 tests/data/test-abicompat/test10/test10-fn-changed-report-2.txt
 create mode 100644 tests/data/test-abicompat/test10/test10-fn-changed-report-3.txt
 create mode 100644 tests/data/test-abicompat/test10/test10-fn-changed-report-4.txt
 create mode 100644 tests/data/test-abicompat/test10/test10-with-exported-symbols.cc
 create mode 100644 tests/data/test-abicompat/test10/test10-with-exported-symbols.h
 create mode 100644 tests/data/test-abicompat/test10/test10-with-incompatible-exported-symbols.cc
 create mode 100644 tests/data/test-abicompat/test10/test10-with-incompatible-exported-symbols.h
 create mode 100644 tests/data/test-abicompat/test6-undefined-var.cc
 delete mode 100755 tests/data/test-abicompat/test6-var-changed-app
 delete mode 100644 tests/data/test-abicompat/test6-var-changed-app.cc
 create mode 100644 tests/data/test-abicompat/test6-var-changed-report-2.txt
 create mode 100755 tests/data/test-abicompat/test7-fn-changed-app.btf
 create mode 100644 tests/data/test-abicompat/test7-fn-changed-report-0.1.txt
 create mode 100644 tests/data/test-abicompat/test7-fn-changed-report-2.1.txt

-- 
2.39.3


-- 
		Dodji


             reply	other threads:[~2024-03-14 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 16:54 Dodji Seketeli [this message]
2024-03-14 16:57 ` [PATCH 1/4] Represent undefined corpus interfaces to analyze app compatibility Dodji Seketeli
2024-03-14 16:59 ` [PATCH 2/4] Factorize elf-reader::{variable,function}_symbol_is_exported into symtab Dodji Seketeli
2024-03-14 17:00 ` [PATCH 3/4] Add support for undefined symbols in the BTF reader Dodji Seketeli
2024-03-14 17:00 ` [PATCH 4/4] Emit & read undefined interfaces to & from ABIXML Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttl83gaw.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).