[PATCH] Move nested functions in libdw/cfi.c to file scope.
by Chih-Hung Hsieh
* No nested functions to compile with clang/llvm.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdw/ChangeLog | 5 ++++
libdw/cfi.c | 87 +++++++++++++++++++++++++++++----------------------------
2 files changed, 50 insertions(+), 42 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 39c49aa..4242a7c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-14 Chih-Hung Hsieh <chh(a)google.com>
+
+ * cfi.c (execute_cfi): Move nested functions 'enough_registers'
+ and 'require_cfa_offset' to file scope.
+
2015-10-09 Josh Stone <jistone(a)redhat.com>
* dwarf_begin.c (dwarf_begin): Replace stat64 and fstat64 with stat
diff --git a/libdw/cfi.c b/libdw/cfi.c
index 5a6f956..1fd668d 100644
--- a/libdw/cfi.c
+++ b/libdw/cfi.c
@@ -56,6 +56,46 @@ duplicate_frame_state (const Dwarf_Frame *original,
return copy;
}
+static inline bool
+enough_registers (Dwarf_Word reg, Dwarf_Frame **pfs, int *result)
+{
+ /* Don't allow insanely large register numbers. 268435456 registers
+ should be enough for anybody. And very large values might overflow
+ the array size and offsetof calculations below. */
+ if (unlikely (reg >= INT32_MAX / sizeof ((*pfs)->regs[0])))
+ {
+ *result = DWARF_E_INVALID_CFI;
+ return false;
+ }
+
+ if ((*pfs)->nregs <= reg)
+ {
+ size_t size = offsetof (Dwarf_Frame, regs[reg + 1]);
+ Dwarf_Frame *bigger = realloc (*pfs, size);
+ if (unlikely (bigger == NULL))
+ {
+ *result = DWARF_E_NOMEM;
+ return false;
+ }
+ else
+ {
+ eu_static_assert (reg_unspecified == 0);
+ memset (bigger->regs + bigger->nregs, 0,
+ (reg + 1 - bigger->nregs) * sizeof bigger->regs[0]);
+ bigger->nregs = reg + 1;
+ *pfs = bigger;
+ }
+ }
+ return true;
+}
+
+static inline void
+require_cfa_offset (Dwarf_Frame *fs)
+{
+ if (unlikely (fs->cfa_rule != cfa_offset))
+ fs->cfa_rule = cfa_invalid;
+}
+
/* Returns a DWARF_E_* error code, usually NOERROR or INVALID_CFI.
Frees *STATE on failure. */
static int
@@ -77,46 +117,9 @@ execute_cfi (Dwarf_CFI *cache,
} while (0)
Dwarf_Frame *fs = *state;
- inline bool enough_registers (Dwarf_Word reg)
- {
- /* Don't allow insanely large register numbers. 268435456 registers
- should be enough for anybody. And very large values might overflow
- the array size and offsetof calculations below. */
- if (unlikely (reg >= INT32_MAX / sizeof (fs->regs[0])))
- {
- result = DWARF_E_INVALID_CFI;
- return false;
- }
-
- if (fs->nregs <= reg)
- {
- size_t size = offsetof (Dwarf_Frame, regs[reg + 1]);
- Dwarf_Frame *bigger = realloc (fs, size);
- if (unlikely (bigger == NULL))
- {
- result = DWARF_E_NOMEM;
- return false;
- }
- else
- {
- eu_static_assert (reg_unspecified == 0);
- memset (bigger->regs + bigger->nregs, 0,
- (reg + 1 - bigger->nregs) * sizeof bigger->regs[0]);
- bigger->nregs = reg + 1;
- fs = bigger;
- }
- }
- return true;
- }
-
- inline void require_cfa_offset (void)
- {
- if (unlikely (fs->cfa_rule != cfa_offset))
- fs->cfa_rule = cfa_invalid;
- }
#define register_rule(regno, r_rule, r_value) do { \
- if (unlikely (! enough_registers (regno))) \
+ if (unlikely (! enough_registers (regno, &fs, &result))) \
goto out; \
fs->regs[regno].rule = reg_##r_rule; \
fs->regs[regno].value = (r_value); \
@@ -179,7 +182,7 @@ execute_cfi (Dwarf_CFI *cache,
case DW_CFA_def_cfa_register:
get_uleb128 (regno, program, end);
- require_cfa_offset ();
+ require_cfa_offset (fs);
fs->cfa_val_reg = regno;
continue;
@@ -193,7 +196,7 @@ execute_cfi (Dwarf_CFI *cache,
case DW_CFA_def_cfa_offset:
get_uleb128 (offset, program, end);
def_cfa_offset:
- require_cfa_offset ();
+ require_cfa_offset (fs);
fs->cfa_val_offset = offset;
continue;
@@ -310,7 +313,7 @@ execute_cfi (Dwarf_CFI *cache,
cfi_assert (cie->initial_state != NULL);
/* Restore the CIE's initial rule for this register. */
- if (unlikely (! enough_registers (operand)))
+ if (unlikely (! enough_registers (operand, &fs, &result)))
goto out;
if (cie->initial_state->nregs > operand)
fs->regs[operand] = cie->initial_state->regs[operand];
@@ -347,7 +350,7 @@ execute_cfi (Dwarf_CFI *cache,
case DW_CFA_GNU_window_save:
/* This is magic shorthand used only by SPARC. It's equivalent
to a bunch of DW_CFA_register and DW_CFA_offset operations. */
- if (unlikely (! enough_registers (31)))
+ if (unlikely (! enough_registers (31, &fs, &result)))
goto out;
for (regno = 8; regno < 16; ++regno)
{
--
2.6.0.rc2.230.g3dd15c0
8 years, 6 months
[PATCH] Move nested functions in libdwelf.
by Chih-Hung Hsieh
* Move nested functions to file scope
in libdwelf/dwelf_elf_gnu_build_id.c
to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdwelf/ChangeLog | 5 ++++
libdwelf/dwelf_elf_gnu_build_id.c | 49 +++++++++++++++++++++++----------------
2 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/libdwelf/ChangeLog b/libdwelf/ChangeLog
index 342cb9c..f182ecf 100644
--- a/libdwelf/ChangeLog
+++ b/libdwelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-14 Chih-Hung Hsieh <chh(a)google.com>
+
+ * dwelf_elf_gnu_build_id.c (find_elf_build_id): Move nested function
+ 'check_notes' to file scope.
+
2014-11-14 Mark Wielaard <mjw(a)redhat.com>
* dwelf_elf_gnu_debuglink.c (dwelf_elf_gnu_debuglink): Check d_buf
diff --git a/libdwelf/dwelf_elf_gnu_build_id.c b/libdwelf/dwelf_elf_gnu_build_id.c
index 1ed501d..8c78c70 100644
--- a/libdwelf/dwelf_elf_gnu_build_id.c
+++ b/libdwelf/dwelf_elf_gnu_build_id.c
@@ -35,33 +35,36 @@
#define NO_VADDR ((GElf_Addr) -1l)
-/* Defined here for reuse. The dwelf interface doesn't care about the
- address of the note, but libdwfl does. */
static int
-find_elf_build_id (Dwfl_Module *mod, int e_type, Elf *elf,
- const void **build_id_bits, GElf_Addr *build_id_elfaddr,
- int *build_id_len)
+check_notes (Elf_Data *data, GElf_Addr data_elfaddr,
+ const void **build_id_bits, GElf_Addr *build_id_elfaddr,
+ int *build_id_len)
{
- int check_notes (Elf_Data *data, GElf_Addr data_elfaddr)
- {
- size_t pos = 0;
- GElf_Nhdr nhdr;
- size_t name_pos;
- size_t desc_pos;
- while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos, &desc_pos)) > 0)
- if (nhdr.n_type == NT_GNU_BUILD_ID
- && nhdr.n_namesz == sizeof "GNU" && !memcmp (data->d_buf + name_pos,
- "GNU", sizeof "GNU"))
+ size_t pos = 0;
+ GElf_Nhdr nhdr;
+ size_t name_pos;
+ size_t desc_pos;
+ while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos, &desc_pos)) > 0)
+ if (nhdr.n_type == NT_GNU_BUILD_ID
+ && nhdr.n_namesz == sizeof "GNU"
+ && !memcmp (data->d_buf + name_pos, "GNU", sizeof "GNU"))
{
*build_id_bits = data->d_buf + desc_pos;
*build_id_elfaddr = (data_elfaddr == NO_VADDR
- ? 0 : data_elfaddr + desc_pos);
+ ? 0 : data_elfaddr + desc_pos);
*build_id_len = nhdr.n_descsz;
return 1;
}
- return 0;
- }
+ return 0;
+}
+/* Defined here for reuse. The dwelf interface doesn't care about the
+ address of the note, but libdwfl does. */
+static int
+find_elf_build_id (Dwfl_Module *mod, int e_type, Elf *elf,
+ const void **build_id_bits, GElf_Addr *build_id_elfaddr,
+ int *build_id_len)
+{
size_t shstrndx = SHN_UNDEF;
int result = 0;
@@ -86,7 +89,10 @@ find_elf_build_id (Dwfl_Module *mod, int e_type, Elf *elf,
phdr->p_offset,
phdr->p_filesz,
ELF_T_NHDR),
- phdr->p_vaddr);
+ phdr->p_vaddr,
+ build_id_bits,
+ build_id_elfaddr,
+ build_id_len);
}
}
else
@@ -105,7 +111,10 @@ find_elf_build_id (Dwfl_Module *mod, int e_type, Elf *elf,
else if (__libdwfl_relocate_value (mod, elf, &shstrndx,
elf_ndxscn (scn), &vaddr))
vaddr = NO_VADDR;
- result = check_notes (elf_getdata (scn, NULL), vaddr);
+ result = check_notes (elf_getdata (scn, NULL), vaddr,
+ build_id_bits,
+ build_id_elfaddr,
+ build_id_len);
}
}
while (result == 0 && (scn = elf_nextscn (elf, scn)) != NULL);
--
2.6.0.rc2.230.g3dd15c0
8 years, 6 months
[PATCH] Move nested functions in libelf.
by Chih-Hung Hsieh
* Move nested functions to file scope
in libelf/elf_begin.c and elf32_updatefile.c
to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libelf/ChangeLog | 7 +++++++
libelf/elf32_updatefile.c | 50 +++++++++++++++++++++++++----------------------
libelf/elf_begin.c | 30 ++++++++++++++--------------
3 files changed, 49 insertions(+), 38 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index af2438b..983b16b 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-13 Chih-Hung Hsieh <chh(a)google.com>
+
+ * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Move nested
+ function 'fill_mmap' to file scope.
+ * elf_begin.c (elf_begin): Move nested function 'lock_dup_elf'
+ to file scope.
+
2015-10-05 Mark Wielaard <mjw(a)redhat.com>
* elf_update.c (write_file): Only use posix_fallocate when using
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index 832f852..0909219 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -101,6 +101,29 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list)
}
+static inline void
+fill_mmap (size_t offset, char *last_position, char *scn_start,
+ char *const shdr_start, char *const shdr_end)
+{
+ size_t written = 0;
+
+ if (last_position < shdr_start)
+ {
+ written = MIN (scn_start + offset - last_position,
+ shdr_start - last_position);
+
+ memset (last_position, __libelf_fill_byte, written);
+ }
+
+ if (last_position + written != scn_start + offset
+ && shdr_end < scn_start + offset)
+ {
+ char *fill_start = MAX (shdr_end, scn_start);
+ memset (fill_start, __libelf_fill_byte,
+ scn_start + offset - fill_start);
+ }
+}
+
int
internal_function
__elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
@@ -303,27 +326,6 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
Elf_Data_List *dl = &scn->data_list;
bool scn_changed = false;
- void fill_mmap (size_t offset)
- {
- size_t written = 0;
-
- if (last_position < shdr_start)
- {
- written = MIN (scn_start + offset - last_position,
- shdr_start - last_position);
-
- memset (last_position, __libelf_fill_byte, written);
- }
-
- if (last_position + written != scn_start + offset
- && shdr_end < scn_start + offset)
- {
- char *fill_start = MAX (shdr_end, scn_start);
- memset (fill_start, __libelf_fill_byte,
- scn_start + offset - fill_start);
- }
- }
-
if (scn->data_list_rear != NULL)
do
{
@@ -338,7 +340,8 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
|| ((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,
+ shdr_start, shdr_end);
last_position = scn_start + dl->data.d.d_off;
}
@@ -390,7 +393,8 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
/* If the previous section (or the ELF/program
header) changed we might have to fill the gap. */
if (scn_start > last_position && previous_scn_changed)
- fill_mmap (0);
+ fill_mmap (0, last_position, scn_start,
+ shdr_start, shdr_end);
/* We have to trust the existing section header information. */
last_position = scn_start + shdr->sh_size;
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 213b5c0..f26119c 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -1039,6 +1039,19 @@ write_file (int fd, Elf_Cmd cmd)
return result;
}
+/* Lock if necessary before dup an archive. */
+static inline Elf *
+lock_dup_elf (int fildes, Elf_Cmd cmd, Elf *ref)
+{
+ /* We need wrlock to dup an archive. */
+ if (ref->kind == ELF_K_AR)
+ {
+ rwlock_unlock (ref->lock);
+ rwlock_wrlock (ref->lock);
+ }
+ /* Duplicate the descriptor. */
+ return dup_elf (fildes, cmd, ref);
+}
/* Return a descriptor for the file belonging to FILDES. */
Elf *
@@ -1063,19 +1076,6 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
return NULL;
}
- Elf *lock_dup_elf (void)
- {
- /* We need wrlock to dup an archive. */
- if (ref->kind == ELF_K_AR)
- {
- rwlock_unlock (ref->lock);
- rwlock_wrlock (ref->lock);
- }
-
- /* Duplicate the descriptor. */
- return dup_elf (fildes, cmd, ref);
- }
-
switch (cmd)
{
case ELF_C_NULL:
@@ -1096,7 +1096,7 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
case ELF_C_READ:
case ELF_C_READ_MMAP:
if (ref != NULL)
- retval = lock_dup_elf ();
+ retval = lock_dup_elf (fildes, cmd, ref);
else
/* Create descriptor for existing file. */
retval = read_file (fildes, 0, ~((size_t) 0), cmd, NULL);
@@ -1117,7 +1117,7 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
retval = NULL;
}
else
- retval = lock_dup_elf ();
+ retval = lock_dup_elf (fildes, cmd, ref);
}
else
/* Create descriptor for existing file. */
--
2.6.0.rc2.230.g3dd15c0
8 years, 6 months
Bugzilla component missing and another (minor) fuzzing-related bug report
by Hanno Böck
Hi,
The elfutils webpage says:
"To report bugs: please open a bugzilla report against the elfutils
component."
However it seems the redhat bugzilla doesn't have an elfutils
component. Therefore I'm reporting it here, hope that's okay.
The attached file will cause a huge malloc allocation with elfutils' nm
tool. This will crash if you try to run it with address sanitizer.
The reason is likely that nm will try to allocate space for something
based on the header value - no matter if that value makes any sense. A
sanity check that checks in such cases if the file itself is smaller
than the supposedly allocated memory could avoid that.
Address Sanitizer trace:
==29915==ERROR: AddressSanitizer failed to allocate 0xb18002000
(47647301632) bytes of LargeMmapAllocator: 12
==19508==AddressSanitizer CHECK
failed: /var/tmp/portage/sys-devel/gcc-4.9.2/work/gcc-4.9.2/libsanitizer/sanitizer_common/sanitizer_posix.cc:66
"(("unable to mmap" && 0)) != (0)" (0x0, 0x0) #0 0x7f1a5001df90
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x5cf90) #1
0x7f1a500221f3 in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x611f3) #2
0x7f1a50027041
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x66041) #3
0x7f1a4ffddad8
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x1cad8) #4
0x7f1a5001868f in malloc
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x5768f) #5
0x41a421 in xmalloc /f/elfutils/elfutils-0.163/lib/xmalloc.c:52 #6
0x4089a4 in show_symbols /f/elfutils/elfutils-0.163/src/nm.c:1212 #7
0x40ce47 in handle_elf /f/elfutils/elfutils-0.163/src/nm.c:1484 #8
0x4033a6 in process_file /f/elfutils/elfutils-0.163/src/nm.c:387 #9
0x4033a6 in main /f/elfutils/elfutils-0.163/src/nm.c:248 #10
0x7f1a4f2cef9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f) #11
0x40438e (/old-ram/elfutils/nm+0x40438e)
--
Hanno Böck
http://hboeck.de/
mail/jabber: hanno(a)hboeck.de
GPG: BBB51E42
8 years, 6 months
[PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
by Mark Wielaard
In debuginfo files the phdrs file offsets match those of the original ELF
file. So the section header file offsets and the TLS symbol value offset
in debuginfo files cannot be sanity checked against the phdrs file offset.
The issue can be triggered with run-strip-strmerge.sh test when configured
with --enable-gcov. Which will insert a .tbss section and TLS symbols that
trigger the above checks.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
src/ChangeLog | 7 +++++++
src/elflint.c | 5 +++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 0d2b1d6..f9e3b4a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2015-10-16 Mark Wielaard <mjw(a)redhat.com>
+ * elflint.c (check_symtab): Don't check TLS symbol value against TLS
+ phdr offset in debuginfo files.
+ (check_sections): Don't try to match section offsets to phdrs offsets
+ in debuginfo files.
+
+2015-10-16 Mark Wielaard <mjw(a)redhat.com>
+
* elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
SHF_MERGE and SHF_STRINGS set.
diff --git a/src/elflint.c b/src/elflint.c
index eada4d5..7d72a1f 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -864,7 +864,7 @@ section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n"),
section [%2d] '%s': symbol %zu: TLS symbol but couldn't get TLS program header entry\n"),
idx, section_name (ebl, idx), cnt);
}
- else
+ else if (!is_debuginfo)
{
if (st_value
< destshdr->sh_offset - phdr->p_offset)
@@ -3955,7 +3955,8 @@ section [%2zu] '%s' is both executable and writable\n"),
}
}
- if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)
+ if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0
+ && !is_debuginfo)
{
/* Make sure the section is contained in a loaded segment
and that the initialization part matches NOBITS sections. */
--
2.4.3
8 years, 6 months
elfutils 0.164 released
by Mark Wielaard
A new release of elfutils is available now at:
https://fedorahosted.org/releases/e/l/elfutils/0.164/
* NEWS *
strip, unstrip: Handle ELF files with merged strtab/shstrtab tables.
Handle missing SHF_INFO_LINK section flags.
libelf: Use int64_t for offsets in libelf.h instead of loff_t.
libdw: dwarf.h Add preliminary DWARF5 DW_LANG_Haskell.
libdwfl: dwfl_standard_find_debuginfo now searches any subdir of the binary
path under the debuginfo root when the separate debug file couldn't
be found by build-id.
dwfl_linux_proc_attach can now be called before any Dwfl_Modules
have been reported.
backends: Better sparc and sparc64 support.
translations: Updated Ukrainian translation.
Provide default-yama-scope subpackage.
* GIT SHORTLOG *
Chih-Hung Hsieh (11):
Replace printf %Z length modifier with %z.
Replace some K&R function definitions with ansi-C definitions.
libdw: Add const declaration to getlocations_addr locs.
tests: Remove unused static const variables in md5-sha1-test.c.
tests: Init local variable enctype before use in print_base_type varlocs.c.
libdwfl: Replace abs with llabs for int64_t values.
Initialize variable before use.
Remove redundant NULL tests.
Move 4 libdwfl nested functions.
Do without union of variable length arrays.
Move recursive nested function to file scope.
Dodji Seketeli (1):
Fix finding split debug info files not located by the build-id mechanism
Jose E. Marchesi (7):
sparc: add some missing relocation types.
sparc: fix the extraction of relocation IDs from r_type fields.
Use -fPIC instead of -fpic when generating PIC code.
Use -fPIC instead of -fpic when generating PIC code.
sparc: support for the check_object_attribute ebl hook.
Use seek+read instead of pread to read from /dev/$$/mem files.
Do not rely on ebl_check_special_section when checking debuginfo files.
Josh Stone (3):
Improve AM_SILENT_RULES coverage
Trust AC_SYS_LARGEFILE to provide large file support
libelf: Use int64_t for offsets in libelf.h
Mark Wielaard (29):
nm: First call elf_getdata, then allocate memory.
unstrip: Handle debuginfo files with missing SHF_INFO_LINK section flags.
spec: Provide default-yama-scope.
tests: Add a testcase for dwfl debuginfo-path with separate bin/debug dirs.
elflint: Add gnuld check when a NOBITS section falls inside a segment.
libdw: Add DW_LANG_Haskell.
readelf: handle_core_item large right shift triggers undefined behaviour.
backends: Use ebl->class consistently in sparc backend.
libdwfl: Make dwfl_linux_proc_attach work even without any Dwfl_Modules.
libdw: Don't reassign result pointer in dwarf_peel_type.
Update dl-hash.h from glibc.
Remove old-style function definitions.
Properly mark all internal function definitions.
libelf: Always update e_version and e_shentsize in elf_update.
Handle merged strtab/shstrtab string tables in strip and unstrip.
unstrip: Update sh_info when SH_INFO_LINK_P not just when SHF_INFO_LINK set
Allocate exact amount of bytes for phdrs and shdrs.
strip: Only sanity check symbols to not discarded sections for debug file.
tests: Rename argument from check to statement in elfshphehdr.c.
configure.ac: Add AM_SILENT_RULES([yes])
config: Use ARFLAGS 'cr'.
ldlex: Fix sign-compare warning, suppress -Wstack-usage.
libelf: Only use posix_fallocate when using mmap. Ignore unsupported errors.
elflint: Check relro flags are a subset of the load segment.
Prepare 0.164 release.
tests: Add AM_LDFLAGS to dwfl_proc_attach_LDFLAGS.
ppc: ppc_check_special_symbol): Also allow _SDA_BASE_ in .data section.
elflint: Reject mergable string sections as relocation target.
Regenerate .po files.
Mike Frysinger (1):
ignore more generated files
Pino Toscano (6):
Reduce scope of some includes
tests: Mark an unused argument as such
strings: Define MAP_POPULATE if not defined already
tests: dwfl-bug-fd-leak: Guard against null module addresses
tests: skip run-deleted.sh when dwfl_linux_proc_attach is not implemented
Fix/improve .gitignore
Yuri Chornoivan (1):
Update Ukrainian translation
8 years, 6 months
[COMMITTED] elflint: Reject mergable string sections as relocation target.
by Mark Wielaard
Mergable sections can be the target of a relocation, but only if they
contain items of the same size. So only reject mergable string sections
as target of a relocation section.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
src/ChangeLog | 5 +++++
src/elflint.c | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index f459e11..0d2b1d6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-16 Mark Wielaard <mjw(a)redhat.com>
+
+ * elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
+ SHF_MERGE and SHF_STRINGS set.
+
2015-10-13 Jose E. Marchesi <jose.marchesi(a)oracle.com>
* elflint.c (check_sections): Do not rely on
diff --git a/src/elflint.c b/src/elflint.c
index 0a6f0df..eada4d5 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -1254,9 +1254,10 @@ section [%2d] '%s': sh_info should be zero\n"),
}
}
- if (((*destshdrp)->sh_flags & (SHF_MERGE | SHF_STRINGS)) != 0)
+ if ((((*destshdrp)->sh_flags & SHF_MERGE) != 0)
+ && ((*destshdrp)->sh_flags & SHF_STRINGS) != 0)
ERROR (gettext ("\
-section [%2d] '%s': no relocations for merge-able sections possible\n"),
+section [%2d] '%s': no relocations for merge-able string sections possible\n"),
idx, section_name (ebl, idx));
}
}
--
2.4.3
8 years, 6 months
[COMMITTED] ppc: ppc_check_special_symbol): Also allow _SDA_BASE_ in .data section.
by Mark Wielaard
The Small Data Area Base normally points to .sdata, in which case we
check it is at an offset of 0x8000. It might however fall in the
.data section, in which case we cannot check the offset. The size always
should be zero.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
backends/ChangeLog | 5 +++++
backends/ppc_symbol.c | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog
index e6f3763..6ea3dc4 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-16 Mark Wielaard <mjw(a)redhat.com>
+
+ * ppc_symbol.c (ppc_check_special_symbol): Also allow _SDA_BASE_
+ in .data section.
+
2015-10-05 Josh Stone <jistone(a)redhat.com>
* Makefile.am (libebl_%.so): Add AM_V_at and AM_V_CCLD silencers.
diff --git a/backends/ppc_symbol.c b/backends/ppc_symbol.c
index 733114b..37d4918 100644
--- a/backends/ppc_symbol.c
+++ b/backends/ppc_symbol.c
@@ -1,5 +1,5 @@
/* PPC specific symbolic name handling.
- Copyright (C) 2004, 2005, 2007, 2014 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2007, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2004.
@@ -143,9 +143,14 @@ ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
if (sname == NULL)
return false;
+ /* Small data area. Normally points to .sdata, in which case we
+ check it is at an offset of 0x8000. It might however fall in the
+ .data section, in which case we cannot check the offset. The
+ size always should be zero. */
if (strcmp (name, "_SDA_BASE_") == 0)
- return (strcmp (sname, ".sdata") == 0
- && sym->st_value == destshdr->sh_addr + 0x8000
+ return (((strcmp (sname, ".sdata") == 0
+ && sym->st_value == destshdr->sh_addr + 0x8000)
+ || strcmp (sname, ".data") == 0)
&& sym->st_size == 0);
if (strcmp (name, "_SDA2_BASE_") == 0)
--
2.4.3
8 years, 6 months
[COMMITTED] tests: Add AM_LDFLAGS to dwfl_proc_attach_LDFLAGS.
by Mark Wielaard
We want to be sure the libelf.so under test is picked up.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
tests/ChangeLog | 4 ++++
tests/Makefile.am | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 1151550..1913fbb 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-16 Mark Wielaard <mjw(a)redhat.com>
+
+ * Makefile.am (dwfl_proc_attach_LDFLAGS): Add AM_LDFLAGS.
+
2015-10-09 Josh Stone <jistone(a)redhat.com>
* lfs-symbols: New list of LFS-related symbols from lintian.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5612fc7..e04707c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -450,7 +450,7 @@ strptr_LDADD = $(libelf)
newdata_LDADD = $(libelf)
elfstrtab_LDADD = $(libelf)
dwfl_proc_attach_LDADD = $(libdw)
-dwfl_proc_attach_LDFLAGS = -pthread
+dwfl_proc_attach_LDFLAGS = -pthread $(AM_LDFLAGS)
elfshphehdr_LDADD =$(libelf)
elfstrmerge_LDADD = $(libebl) $(libelf)
--
1.8.3.1
8 years, 6 months
Preparing for elfutils 0.164 (Friday)
by Mark Wielaard
Hi,
It has been more than 3 months since 0.163 and I would like to push out
a new release end of the week. There have been more than 45 commits and
various bugs fixed. Some of which have already been backported to some
distros. Lets try to get any pending patches in on Wednesday and do a
release on Friday after some extra testing. Don't worry if any patches
don't make it for this release. We will do another release in ~3 months
again.
I don't intent to do a "portable patch" for this release. If you did use
the portable patch for 0.163 please post your setup and any patches you
depend on so we can include them in the regular release if possible.
Thanks,
Mark
8 years, 6 months