From: Mark Wielaard <mark@klomp.org>
To: Ben Woodard <woodard@redhat.com>
Cc: Ben Woodard via Libabigail <libabigail@sourceware.org>
Subject: Re: libabigail 2.1 trunk testing where are we?
Date: Fri, 29 Jul 2022 22:57:09 +0200 [thread overview]
Message-ID: <YuRJpWXXz+I/BI08@wildebeest.org> (raw)
In-Reply-To: <5BA0C098-9E22-4604-8C13-1D0624B2489F@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
On Fri, Jul 29, 2022 at 11:28:18AM -0700, Ben Woodard via Libabigail wrote:
> 1 crash due to incorrect ELF in that shows up in a small number of
> packages https://sourceware.org/bugzilla/show_bug.cgi?id=29346
I have a patch that should work around that on:
https://code.wildebeest.org/git/user/mjw/libabigail/commit/?h=pr29346
Also attached. Maybe someone with commit access could push it to a
users try branch for testing?
Thanks,
Mark
[-- Attachment #2: 0001-Handle-zero-sh_entsize-in-get_soname_of_elf_file.patch --]
[-- Type: text/x-diff, Size: 1651 bytes --]
From 05c53fcbdbccd8b08dfabd22caa9c7b4625596e8 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 20 Jul 2022 01:01:14 +0200
Subject: [PATCH] Handle zero sh_entsize in get_soname_of_elf_file
Apparently guile produced ELF files don't set sh_entsize for the
dynamic section. Which would cause a divide by zero. Luckily we do
know how big an dynamic entry should be. So use gelf_fsize for
ELF_T_DYN if sh_entsize is zero.
* src/abg-dwarf-reader.cc (get_soname_of_elf_file):
Make sure entsize is non-zero before use.
https://sourceware.org/bugzilla/show_bug.cgi?id=29346
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
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 e5159c89..288a56b8 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -16629,8 +16629,11 @@ get_soname_of_elf_file(const string& path, string &soname)
Elf_Scn* scn = gelf_offscn (elf, phdr->p_offset);
GElf_Shdr shdr_mem;
GElf_Shdr* shdr = gelf_getshdr (scn, &shdr_mem);
+ size_t entsize = (shdr != NULL && shdr->sh_entsize != 0
+ ? shdr->sh_entsize
+ : gelf_fsize (elf, ELF_T_DYN, 1, EV_CURRENT));
int maxcnt = (shdr != NULL
- ? shdr->sh_size / shdr->sh_entsize : INT_MAX);
+ ? shdr->sh_size / entsize : INT_MAX);
ABG_ASSERT (shdr == NULL || shdr->sh_type == SHT_DYNAMIC);
Elf_Data* data = elf_getdata (scn, NULL);
if (data == NULL)
--
2.30.2
next prev parent reply other threads:[~2022-07-29 20:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 18:28 Ben Woodard
2022-07-29 20:57 ` Mark Wielaard [this message]
2022-07-29 22:48 ` Ben Woodard
2022-09-20 8:47 ` Dodji Seketeli
2022-09-20 15:05 ` Mark Wielaard
2022-09-25 7:06 ` 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=YuRJpWXXz+I/BI08@wildebeest.org \
--to=mark@klomp.org \
--cc=libabigail@sourceware.org \
--cc=woodard@redhat.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).