public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "Matthias Maennich via libabigail" <libabigail@sourceware.org>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com,
		Matthias Maennich <maennich@google.com>,
	Alessio Balsini <balsini@android.com>
Subject: [PATCH v1] abg-dwarf-reader: detect kernel modules without exports as such
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190724213255.182046-1-maennich@google.com> (raw)

Kernel modules without exported symbols (no use of EXPORT_SYMBOL*()),
will not have a __ksymtab_strings section. Libabigail will therefore
assume they are usual ELF binaries. That leads to wrong results as
now all ELF symbols are considered part of the ABI. That is obviously
wrong. Instead consider binaries having a .modinfo section to be kernel
binaries. We keep the __ksymtab_strings condition as vmlinux has no
.modinfo section but a __ksymtab_strings if symbols are exported.

One case is still open (and requires maybe some documentation): if a
kernel does not export symbols (no module support), none of the
conditions apply. But, who would be interested in the ABI of a kernel
that does not expose any?

	* src/abg-dwarf-reader.cc(is_linux_kernel_binary): consider
	  binaries only having a .modinfo section to be kernel binaries

Co-developed-by: Alessio Balsini <balsini@android.com>
Signed-off-by: Alessio Balsini <balsini@android.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
---
 src/abg-dwarf-reader.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 47af7e3516d3..ab3f8e3b2525 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -8350,7 +8350,10 @@ public:
   ///
   bool
   is_linux_kernel_binary() const
-  {return find_section(elf_handle(), "__ksymtab_strings", SHT_PROGBITS);}
+  {
+    return find_section(elf_handle(), "__ksymtab_strings", SHT_PROGBITS)
+	   || find_section(elf_handle(), ".modinfo", SHT_PROGBITS);
+  }
 
   /// Getter of the "show_stats" flag.
   ///
-- 
2.22.0.657.g960e92d24f-goog

             reply	other threads:[~2019-07-24 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 Matthias Maennich via libabigail [this message]
2019-01-01  0:00 ` Mark Wielaard
2019-01-01  0:00   ` Matthias Maennich via libabigail
2019-01-01  0:00   ` Dodji Seketeli
2019-01-01  0:00 ` 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=20190724213255.182046-1-maennich@google.com \
    --to=libabigail@sourceware.org \
    --cc=balsini@android.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=maennich@google.com \
    /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).