[PATCH] libelf: Check e_shoff alignment before direct access of Elf(32|64)_Shdr.
by Mark Wielaard
In get_shnum the check was whether the Elf(32|64)_Ehdr was correctly
aligned, but to access the Shdr directly we need to check whether the
address that points to the Elf(32|64)_Shdr structure is correctly aligned.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 5 +++++
libelf/elf_begin.c | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index c57c6a2..a54a80b 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-04 Mark Wielaard <mjw(a)redhat.com>
+
+ * elf_begin.c (get_shnum): Check alignment of Shdr, not Ehdr before
+ direct access.
+
2015-06-02 Mark Wielaard <mjw(a)redhat.com>
* elf_getdata.c (convert_data): Make sure source data is properly
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index e2e3b6b..f002ebf 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -151,8 +151,8 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) map_address + offset))
- & (__alignof__ (Elf32_Ehdr) - 1)) == 0))
+ || (((size_t) ((char *) map_address + ehdr.e32->e_shoff))
+ & (__alignof__ (Elf32_Shdr) - 1)) == 0))
/* We can directly access the memory. */
result = ((Elf32_Shdr *) ((char *) map_address + ehdr.e32->e_shoff
+ offset))->sh_size;
@@ -201,8 +201,8 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
Elf64_Xword size;
if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) map_address + offset))
- & (__alignof__ (Elf64_Ehdr) - 1)) == 0))
+ || (((size_t) ((char *) map_address + ehdr.e64->e_shoff))
+ & (__alignof__ (Elf64_Shdr) - 1)) == 0))
/* We can directly access the memory. */
size = ((Elf64_Shdr *) ((char *) map_address + ehdr.e64->e_shoff
+ offset))->sh_size;
--
2.1.0
8 years, 10 months
[PATCH] libdwfl: Fix memory leak in find_debuginfo_in_path.
by Mark Wielaard
commit c4f133 libdwfl: find_debuginfo_in_patch don't alloca/strdupa
strings of unknown size. Introduced a memory leak in the case nothing
was found. Make sure before returning all temporary strings are all
freed.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/find-debuginfo.c | 18 ++++++++----------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 956ac9f..a5253e2 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2015-06-06 Mark Wielaard <mjw(a)redhat.com>
+ * find-debuginfo.c (find_debuginfo_in_path): Always free localpath,
+ localname and file_dirname.
+
+2015-06-06 Mark Wielaard <mjw(a)redhat.com>
+
* derelocate.c (cache_sections): Free sortrefs.
2015-06-05 Mark Wielaard <mjw(a)redhat.com>
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index 9b911c1..c523354 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -293,19 +293,13 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
}
continue;
default:
- {
- fail_free:
- free (localpath);
- free (localname);
- free (file_dirname);
- return -1;
- }
+ goto fail_free;
}
- free (localpath);
- free (localname);
- free (file_dirname);
if (validate (mod, fd, check, debuglink_crc))
{
+ free (localpath);
+ free (localname);
+ free (file_dirname);
*debuginfo_file_name = fname;
return fd;
}
@@ -315,6 +309,10 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
/* No dice. */
errno = 0;
+fail_free:
+ free (localpath);
+ free (localname);
+ free (file_dirname);
return -1;
}
--
2.1.0
8 years, 10 months
[PATCH] libdwfl: Fix memory leak in cache_sections.
by Mark Wielaard
commit be1778 libdwfl: Fix possible unbounded stack usage in cache_sections.
introduced a memory leak. The refs pointers were copied to the sortrefs
array but never freed. Only the array was freed. Also free the elements.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/derelocate.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0daf893..956ac9f 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-06 Mark Wielaard <mjw(a)redhat.com>
+
+ * derelocate.c (cache_sections): Free sortrefs.
+
2015-06-05 Mark Wielaard <mjw(a)redhat.com>
* dwfl_segment_report_module.c (dwfl_segment_report_module):
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index 48f8193..439a24e 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -177,6 +177,7 @@ cache_sections (Dwfl_Module *mod)
mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs;
mod->reloc_info->refs[i].start = sortrefs[i]->start;
mod->reloc_info->refs[i].end = sortrefs[i]->end;
+ free (sortrefs[i]);
}
free (sortrefs);
--
2.1.0
8 years, 10 months
[PATCH] libelf: Make sure elf_getdata_rawchunk returns aligned data.
by Mark Wielaard
elf_getdata_rawchunk might return an unaligned buffer for the requested
ELF data type. Make sure the data is also correctly aligned when using
an mmapped file. Also add some missing alignments for ELF data types
for __libelf_type_align (the missing types could also make elf_getdata
to return unaligned data).
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 8 ++++++++
libelf/elf_getdata.c | 9 +++++++++
libelf/elf_getdata_rawchunk.c | 20 +++++++++++++++++---
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index a54a80b..c818400 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,13 @@
2015-06-04 Mark Wielaard <mjw(a)redhat.com>
+ * elf_getdata.c (__libelf_type_aligns): Add entries for ELF_T_EHDR,
+ ELF_T_OFF, ELF_T_PHDR, ELF_T_SHDR, ELF_T_SWORD, ELF_T_XWORD,
+ ELF_T_SXWORD, ELF_T_GNUHASH, ELF_T_AUXV.
+ * elf_getdata_rawchunk.c (elf_getdata_rawchunk): Check alignment
+ of rawdata against requested type.
+
+2015-06-04 Mark Wielaard <mjw(a)redhat.com>
+
* elf_begin.c (get_shnum): Check alignment of Shdr, not Ehdr before
direct access.
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 1a4981e..770e035 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -83,8 +83,15 @@ const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
# define TYPE_ALIGNS(Bits) \
{ \
[ELF_T_ADDR] = __alignof__ (ElfW2(Bits,Addr)), \
+ [ELF_T_EHDR] = __alignof__ (ElfW2(Bits,Ehdr)), \
[ELF_T_HALF] = __alignof__ (ElfW2(Bits,Half)), \
+ [ELF_T_OFF] = __alignof__ (ElfW2(Bits,Off)), \
+ [ELF_T_PHDR] = __alignof__ (ElfW2(Bits,Phdr)), \
+ [ELF_T_SHDR] = __alignof__ (ElfW2(Bits,Shdr)), \
+ [ELF_T_SWORD] = __alignof__ (ElfW2(Bits,Sword)), \
[ELF_T_WORD] = __alignof__ (ElfW2(Bits,Word)), \
+ [ELF_T_XWORD] = __alignof__ (ElfW2(Bits,Xword)), \
+ [ELF_T_SXWORD] = __alignof__ (ElfW2(Bits,Sxword)), \
[ELF_T_SYM] = __alignof__ (ElfW2(Bits,Sym)), \
[ELF_T_SYMINFO] = __alignof__ (ElfW2(Bits,Syminfo)), \
[ELF_T_REL] = __alignof__ (ElfW2(Bits,Rel)), \
@@ -97,6 +104,8 @@ const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
[ELF_T_MOVE] = __alignof__ (ElfW2(Bits,Move)), \
[ELF_T_LIB] = __alignof__ (ElfW2(Bits,Lib)), \
[ELF_T_NHDR] = __alignof__ (ElfW2(Bits,Nhdr)), \
+ [ELF_T_GNUHASH] = __alignof__ (Elf32_Word), \
+ [ELF_T_AUXV] = __alignof__ (ElfW2(Bits,auxv_t)), \
}
[EV_CURRENT - 1] =
{
diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c
index 63a9914..5cc11e7 100644
--- a/libelf/elf_getdata_rawchunk.c
+++ b/libelf/elf_getdata_rawchunk.c
@@ -79,9 +79,24 @@ elf_getdata_rawchunk (elf, offset, size, type)
rwlock_rdlock (elf->lock);
- /* If the file is mmap'ed we can use it directly. */
+ size_t align = __libelf_type_align (elf->class, type);
if (elf->map_address != NULL)
- rawchunk = elf->map_address + elf->start_offset + offset;
+ {
+ /* If the file is mmap'ed we can use it directly, if aligned for type. */
+ char *rawdata = elf->map_address + elf->start_offset + offset;
+ if (ALLOW_UNALIGNED ||
+ ((uintptr_t) rawdata & (align - 1)) == 0)
+ rawchunk = rawdata;
+ else
+ {
+ /* We allocate the memory and memcpy it to get aligned data. */
+ rawchunk = malloc (size);
+ if (rawchunk == NULL)
+ goto nomem;
+ memcpy (rawchunk, rawdata, size);
+ flags = ELF_F_MALLOCED;
+ }
+ }
else
{
/* We allocate the memory and read the data from the file. */
@@ -108,7 +123,6 @@ elf_getdata_rawchunk (elf, offset, size, type)
}
/* Copy and/or convert the data as needed for aligned native-order access. */
- size_t align = __libelf_type_align (elf->class, type);
void *buffer;
if (elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA)
{
--
1.8.3.1
8 years, 10 months
[PATCH] libelf: Make sure conversion functions work on aligned data for type.
by Mark Wielaard
The gelf_xlate conversion functions work on properly aligned ELF data
types. If elf_get data needs to do conversion and ! ALLOW_UNALIGNED
and the rawdata_base isn't aligned properly for the section type, then
provide an aligned copy of the data.
Found with --enable-sanitize-undefined in run-test-archive64.sh on x86_64.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 5 +++++
libelf/elf_getdata.c | 26 ++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index fd2fc53..c57c6a2 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,10 @@
2015-06-02 Mark Wielaard <mjw(a)redhat.com>
+ * elf_getdata.c (convert_data): Make sure source data is properly
+ aligned for type before calling actual conversion function.
+
+2015-06-02 Mark Wielaard <mjw(a)redhat.com>
+
* elf_begin.c (file_read_elf): Split checks for ehdr and shdr
alignment, drop phdr alignment check.
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 8567da1..1a4981e 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -1,5 +1,5 @@
/* Return the next data element from the section after possibly converting it.
- Copyright (C) 1998-2005, 2006, 2007 Red Hat, Inc.
+ Copyright (C) 1998-2005, 2006, 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -144,6 +144,25 @@ convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,
return;
}
+ /* Make sure the source is correctly aligned for the conversion
+ function to directly access the data elements. */
+ char *rawdata_source;
+ if (ALLOW_UNALIGNED ||
+ ((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0)
+ rawdata_source = scn->rawdata_base;
+ else
+ {
+ rawdata_source = (char *) malloc (size);
+ if (rawdata_source == NULL)
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return;
+ }
+
+ /* The copy will be appropriately aligned for direct access. */
+ memcpy (rawdata_source, scn->rawdata_base, size);
+ }
+
/* Get the conversion function. */
#if EV_NUM != 2
fp = __elf_xfctstom[version - 1][__libelf_version - 1][eclass - 1][type];
@@ -151,7 +170,10 @@ convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,
fp = __elf_xfctstom[0][0][eclass - 1][type];
#endif
- fp (scn->data_base, scn->rawdata_base, size, 0);
+ fp (scn->data_base, rawdata_source, size, 0);
+
+ if (rawdata_source != scn->rawdata_base)
+ free (rawdata_source);
}
scn->data_list.data.d.d_buf = scn->data_base;
--
2.1.0
8 years, 10 months
[COMMITTED] Ukrainian translation update
by Mark Wielaard
From: Yuri Chornoivan <yurchor(a)ukr.net>
https://bugzilla.redhat.com/show_bug.cgi?id=1139815
Signed-off-by: Yuri Chornoivan <yurchor(a)ukr.net>
---
po/uk.po | 41 +++++++++++++++++++----------------------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/po/uk.po b/po/uk.po
index 08a7047..28e0f38 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -375,63 +375,59 @@ msgstr "дані розділу «.gnu.prelink_undo» пошкоджено"
#: libdwfl/libdwflP.h:82
msgid "Internal error due to ebl"
-msgstr ""
+msgstr "Внутрішня помилка через ebl"
#: libdwfl/libdwflP.h:83
msgid "Missing data in core file"
-msgstr ""
+msgstr "У файлі ядра не вистачає даних"
#: libdwfl/libdwflP.h:84
-#, fuzzy
msgid "Invalid register"
-msgstr "некоректний параметр"
+msgstr "Некоректний регістр"
#: libdwfl/libdwflP.h:85
msgid "Error reading process memory"
-msgstr ""
+msgstr "Помилка під час спроби читання пам’яті процесу"
#: libdwfl/libdwflP.h:86
msgid "Couldn't find architecture of any ELF"
-msgstr ""
+msgstr "Не вдалося знайти хоч якусь архітектуру ELF"
#: libdwfl/libdwflP.h:87
msgid "Error parsing /proc filesystem"
-msgstr ""
+msgstr "Помилка під час спроби обробки файлової системи /proc"
#: libdwfl/libdwflP.h:88
-#, fuzzy
msgid "Invalid DWARF"
-msgstr "некоректний запис DWARF"
+msgstr "Некоректний запис DWARF"
#: libdwfl/libdwflP.h:89
msgid "Unsupported DWARF"
-msgstr ""
+msgstr "Непідтримуваний запис DWARF"
#: libdwfl/libdwflP.h:90
msgid "Unable to find more threads"
-msgstr ""
+msgstr "Не вдалося знайти додаткові потоки"
#: libdwfl/libdwflP.h:91
msgid "Dwfl already has attached state"
-msgstr ""
+msgstr "Dwfl уже перебуває у стані долучення до процесу"
#: libdwfl/libdwflP.h:92
msgid "Dwfl has no attached state"
-msgstr ""
+msgstr "Dwfl не перебуває у стані долучення до процесу"
#: libdwfl/libdwflP.h:93
msgid "Unwinding not supported for this architecture"
-msgstr ""
+msgstr "Для цієї архітектури розгортання не передбачено"
#: libdwfl/libdwflP.h:94
-#, fuzzy
msgid "Invalid argument"
-msgstr "некоректний параметр"
+msgstr "Некоректний аргумент"
#: libdwfl/libdwflP.h:95
-#, fuzzy
msgid "Not an ET_CORE ELF file"
-msgstr "не є коректним файлом ELF"
+msgstr "Не є файлом ET_CORE ELF"
#: libebl/eblbackendname.c:42
msgid "No backend"
@@ -680,7 +676,6 @@ msgid "Also show symbol or section names"
msgstr "Показувати також назви символів та розділів"
#: src/addr2line.c:64
-#, fuzzy
msgid "Also show symbol and the section names"
msgstr "Показувати також назви символів та розділів"
@@ -2036,13 +2031,13 @@ msgid "section [%2d] '%s': bitmask size not power of 2: %u\n"
msgstr "розділ [%2d] «%s»: розмір бітової маски не є степенем 2: %u\n"
#: src/elflint.c:2092
-#, fuzzy, c-format
+#, c-format
msgid ""
"section [%2d] '%s': hash table section is too small (is %ld, expected at "
"least %ld)\n"
msgstr ""
-"розділ [%2d] «%s»: розділ таблиці хешів занадто малий (розмір %ld, мало бути "
-"не менше %ld)\n"
+"розділ [%2d] «%s»: розділ таблиці хешів є надто малим (маємо %ld, мало бути "
+"принаймні %ld)\n"
#: src/elflint.c:2100
#, c-format
@@ -6523,6 +6518,8 @@ msgstr "Вивести лише список назв модулів, файлі
#: src/unstrip.c:86
msgid "Force combining files even if some ELF headers don't seem to match"
msgstr ""
+"Примусово поєднати файли, навіть якщо буде встановлено невідповідність "
+"якихось із заголовків ELF"
#: src/unstrip.c:130
#, c-format
--
1.8.3.1
8 years, 10 months
[PATCH] libdw: Initialize filelist early in read_srclines.
by Mark Wielaard
We might jump to "out" early on error. Then filelist might not be set yet
and we might try to free garbage. Set it to the null_file early.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdw/ChangeLog | 4 ++++
libdw/dwarf_getsrclines.c | 23 ++++++++++++-----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index aa4d09c..e9b81f6 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-06 Mark Wielaard <mjw(a)redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Initialize filelist early.
+
2015-05-27 Mark Wielaard <mjw(a)redhat.com>
* encoded-value.h (read_encoded_value): Check data d_size contains
diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c
index d49aedc..ba9649a 100644
--- a/libdw/dwarf_getsrclines.c
+++ b/libdw/dwarf_getsrclines.c
@@ -91,6 +91,18 @@ read_srclines (Dwarf *dbg,
size_t nfilelist = 0;
unsigned int ndirlist = 0;
+ struct filelist null_file =
+ {
+ .info =
+ {
+ .name = "???",
+ .mtime = 0,
+ .length = 0
+ },
+ .next = NULL
+ };
+ struct filelist *filelist = &null_file;
+
/* If there are a large number of lines, files or dirs don't blow up
the stack. Stack allocate some entries, only dynamically malloc
when more than MAX. */
@@ -238,17 +250,6 @@ read_srclines (Dwarf *dbg,
fl; })
/* Now read the files. */
- struct filelist null_file =
- {
- .info =
- {
- .name = "???",
- .mtime = 0,
- .length = 0
- },
- .next = NULL
- };
- struct filelist *filelist = &null_file;
nfilelist = 1;
if (unlikely (linep >= lineendp))
--
2.1.0
8 years, 10 months
[PATCH] libdwfl: Report core module segment even when NT_FILE build-id doesn't match.
by Mark Wielaard
dwfl_segment_report_module can take the NT_FILE note contents to find
the matching file for the module on the file system from the core file.
If the file exists but the build-id didn't match we would not report the
module. But we should just report the module anyway, ignore the file,
and try to match the ELF image another way.
This issue can be replicated by building and running make check in
/tmp/elfutils with run-backtrace-core-aarch64.sh since that core file
includes a NT_FILE note pointing to /tmp/elfutils/tests/backtrace-child.
Which won't match if it was just recompiled.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 6 ++++++
libdwfl/dwfl_segment_report_module.c | 9 +++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 4de3832..0daf893 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-05 Mark Wielaard <mjw(a)redhat.com>
+
+ * dwfl_segment_report_module.c (dwfl_segment_report_module):
+ If the note_file exists, but the build_id doesn't match discard
+ the file and continue reporting.
+
2015-06-01 Mark Wielaard <mjw(a)redhat.com>
* dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Copy path
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 705639d..a0f07ad 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -696,8 +696,13 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
}
if (invalid)
{
- free (build_id);
- return finish ();
+ /* The file was there, but the build_id didn't match. We
+ still want to report the module, but need to get the ELF
+ some other way if possible. */
+ close (fd);
+ fd = -1;
+ elf_end (elf);
+ elf = NULL;
}
}
--
2.1.0
8 years, 10 months
[PATCH] libdwfl: Fix memory leak in __libdwfl_open_by_build_id.
by Mark Wielaard
commit c57829 introduced a memory leak by passing the path string to
strsep. strsep will change the given pointer and set it to NULL eventually.
Causing the original pointer to leak. Fix by passing a copy of the pointer
to strsep.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/dwfl_build_id_find_elf.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index f4e7484..4de3832 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-01 Mark Wielaard <mjw(a)redhat.com>
+
+ * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Copy path
+ pointer before passing to strsep.
+
2015-05-30 Mark Wielaard <mjw(a)redhat.com>
* link_map.c (check32): Use read_4ubyte_unaligned_noncvt to read
diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
index 215782a..99a5059 100644
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -73,7 +73,8 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
int fd = -1;
char *dir;
- while (fd < 0 && (dir = strsep (&path, ":")) != NULL)
+ char *paths = path;
+ while (fd < 0 && (dir = strsep (&paths, ":")) != NULL)
{
if (dir[0] == '+' || dir[0] == '-')
++dir;
--
1.8.3.1
8 years, 10 months
[PATCH] Define MODVERSION in a more reproducable way.
by Mark Wielaard
We define MODVERSION to make sure the libebl backend modules match the
elfutils build when we dlopen them. Using hostname and date makes it very
hard to create reproducable builds. Define them a little more reproducable
using LIBEBL_SUBDIR, eu_version and ac_cv_build.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 5 +++++
configure.ac | 12 ++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c67894e..3444519 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+ * configure.ac (MODVERSION): Define using LIBEBL_SUBDIR, eu_version
+ and ac_cv_build.
+
+2015-05-31 Mark Wielaard <mjw(a)redhat.com>
+
* configure.ac (use_undefined): Use AC_LINK_IFELSE. AC_DEFINE
CHECK_UNDEFINED.
diff --git a/configure.ac b/configure.ac
index 58366d5..f9fb5be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,12 +29,6 @@ dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
AM_MAINTAINER_MODE
-dnl Unique ID for this build.
-MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
-AC_SUBST([MODVERSION])
-AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
-AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
-
AC_CONFIG_SRCDIR([libelf/libelf.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
@@ -388,6 +382,12 @@ esac
# Round up to the next release API (x.y) version.
eu_version=$(( (eu_version + 999) / 1000 ))
+dnl Unique ID for this build.
+MODVERSION="Build for ${LIBEBL_SUBDIR} ${eu_version} ${ac_cv_build}"
+AC_SUBST([MODVERSION])
+AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
+AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
+
AC_CHECK_SIZEOF(long)
# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
--
2.4.2
8 years, 10 months