From: Dodji Seketeli <dodji@seketeli.org>
To: Mark Wielaard <mark@klomp.org>
Cc: Ben Woodard <woodard@redhat.com>,
Ben Woodard via Libabigail <libabigail@sourceware.org>
Subject: Re: libabigail 2.1 trunk testing where are we?
Date: Tue, 20 Sep 2022 10:47:37 +0200 [thread overview]
Message-ID: <87y1ue5t5i.fsf@seketeli.org> (raw)
In-Reply-To: <YuRJpWXXz+I/BI08@wildebeest.org> (Mark Wielaard's message of "Fri, 29 Jul 2022 22:57:09 +0200")
Hello fine fellows!
Mark Wielaard <mark@klomp.org> a écrit:
> 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?
Man, thank you!
[...]
Ben Woodard via Libabigail <libabigail@sourceware.org> a écrit:
> Thanks for the patch.
>
> I put it into my personal develop tree and it relatively immediately
> fixed 4/6 of the packages that I had identified as having that
> problem. The tests on the other two packages are still running and
> have been running for over half an hour and so something is
> working. We will see if they complete before they timeout. I may have
> to move those two to the takes to long to compete group
> https://sourceware.org/bugzilla/show_bug.cgi?id=29303
>
> So this at least fixed:
> guile22
> guile30
> gnucash
> aisleriot
Whoah!
Thank you Ben!
You guys rock.
Okay, so I have just applied this to master.
Mark, by the, way, just for my own education, would it have been ok to
just use gelf_getshdr all the time, rather than using looking at the
sh_entsize property of the section header that can be wrong sometimes?
I am guessing the reason why you chose to keep looking at the later has
to do with potential performance concerns?
Anyway, either way, I am fine.
Here is what got applied exactly:
From f3b889a2cb94f8bb8372db14520d235dda7fdc3b 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>
Signed-off-by: Dodji Seketeli <dodji@redhat.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 56909540..695683ed 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -16425,8 +16425,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.37.2
[...]
Cheers,
--
Dodji
next prev parent reply other threads:[~2022-09-20 8:47 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
2022-07-29 22:48 ` Ben Woodard
2022-09-20 8:47 ` Dodji Seketeli [this message]
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=87y1ue5t5i.fsf@seketeli.org \
--to=dodji@seketeli.org \
--cc=libabigail@sourceware.org \
--cc=mark@klomp.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).