Please look at
https://bugzilla.redhat.com/show_bug.cgi?id=512840
It has a simple reproducer and data file for it.
Here is the fix suggested by the reporter. Please commit what fix you
think is right, and check the parallel non-mmap case is OK too.
Thanks,
Roland
From 6e36a552dab0770c6082aeb054fe8c96ab13834b Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak(a)v3.sk>
Date: Tue, 21 Jul 2009 00:07:48 +0200
Subject: [PATCH] Fix an assert failure with gap between sections
There can be a gap even if the previous section did not change.
Additionally, last_section didn't seem to take the gap into
account, which would result in an assert fail later on.
---
libelf/elf32_updatefile.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index a4d83a1..a5be31d 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -336,10 +336,13 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t
shnum)
/* If there is a gap, fill it. */
if (scn_start + dl->data.d.d_off > last_position
- && ((previous_scn_changed && dl->data.d.d_off == 0)
+ && ((dl->data.d.d_off == 0)
|| ((scn->flags | dl->flags | elf->flags)
& ELF_F_DIRTY) != 0))
- fill_mmap (dl->data.d.d_off);
+ {
+ fill_mmap (dl->data.d.d_off);
+ last_position = scn_start + dl->data.d.d_off;
+ }
if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
{
--
1.6.3.3