diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-01-20 21:55:55 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-02-06 22:24:08 +0100 |
commit | b543cdd95a0f9dfc33c862585f108a7a19728a10 (patch) | |
tree | bad303a9f37cd9ed491ccfb8f6239084eaf71f4b /libelf/libelfP.h | |
parent | 058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9 (diff) | |
download | elfutils-b543cdd95a0f9dfc33c862585f108a7a19728a10.tar.gz |
libelf: Fix elf_newdata when raw ELF file/image data is available.
When ELF data for a section has been read by elf_rawdata, data_read
and rawdata_base are set, but data_list_rear will not be set until the
data will be converted (by elf_getdata). elf_newdata would overwrite
the existing data in that case. Both elf_getdata and elf_update rely
on the fact that when data_list_rear is set they don't have to look
at the raw data anymore. So make sure we update the data list properly
before adding any new data and raw data is available in elf_newdata.
Add newdata test that calls elf_newdata before and after elf_rawdata
and elf_getdata and checks the new size and contents of the section.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf/libelfP.h')
-rw-r--r-- | libelf/libelfP.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libelf/libelfP.h b/libelf/libelfP.h index 3b24e75c..0ad4071d 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -532,6 +532,12 @@ extern Elf_Data *__elf_getdata_rdlock (Elf_Scn *__scn, Elf_Data *__data) internal_function; extern Elf_Data *__elf_rawdata_internal (Elf_Scn *__scn, Elf_Data *__data) attribute_hidden; +/* Should be called to setup first section data element if + data_list_rear is NULL and we know data_read is set and there is + raw data available. Might upgrade the ELF lock from a read to a + write lock. If the lock is already a write lock set wrlocked. */ +extern void __libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked) + attribute_hidden; extern char *__elf_strptr_internal (Elf *__elf, size_t __index, size_t __offset) attribute_hidden; extern Elf_Data *__elf32_xlatetom_internal (Elf_Data *__dest, |