Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tcf-dev] Can debugging be performed if .dynsym is broken?

Hi,
I have a binary (ELF, 32-bit statically linked executable) which has a
broken .dynsym section.  As I understand it .dynsym (which is
loadable) contains a subset of .syms and is required only if the binary is a dynamic library,
which this one isn't.

When adding symbol file to TCF, I get an exception in unpack_elf_symbol_info in the following check of .dynsym:

if (sym_sec->link == 0 || sym_sec->link >= file->section_cnt) str_exception(ERR_INV_FORMAT, "Invalid symbol section");

This is the stack trace:
#0  exception (error=0x20064) at tcf_agent/agent/tcf/framework/exceptions.c:68
#1  0x00007fc04c0a5020 in str_exception (error=0x20013, msg=0x7fc04c18e654 "Invalid symbol section") at tcf_agent/agent/tcf/framework/exceptions.c:80
#2  0x00007fc04c0e5bf5 in unpack_elf_symbol_info (sym_sec=0x2ceaf00, index=0x1, info=0x7fffb25e3860) at tcf_agent/agent/tcf/services/tcf_elf.c:1934
#3  0x00007fc04c0e5e17 in create_symbol_names_hash (tbl=0x2ceaf00) at tcf_agent/agent/tcf/services/tcf_elf.c:1967
#4  0x00007fc04c0e20f3 in create_elf_cache (file_name=0x4c494a0 "/tmp/u-boot") at tcf_agent/agent/tcf/services/tcf_elf.c:933
#5  0x00007fc04c0e2349 in elf_open (file_name=0x4c494a0 "/tmp/u-boot") at tcf_agent/agent/tcf/services/tcf_elf.c:968

If stripping the section .dynsym everthing (or at least adding the
symbol file) seems to be working.

The section .dynsym section is clearly broken (readelf --dyn-syms):
Symbol table '.dynsym' contains 16 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND <corrupt>
     1: 000a2f68     0 NOTYPE  GLOBAL DEFAULT   12 <corrupt>
     2: 0006019f     0 OBJECT  GLOBAL DEFAULT    1 <corrupt>
     3: 00060000     0 NOTYPE  GLOBAL DEFAULT    1 <corrupt>
     4: 00060000     0 NOTYPE  GLOBAL DEFAULT    1 <corrupt>
     5: 00083cdf     0 NOTYPE  GLOBAL DEFAULT  ABS <corrupt>
     6: 0009caa6     0 NOTYPE  GLOBAL DEFAULT    5 <corrupt>
     7: 002b22e4     0 NOTYPE  GLOBAL DEFAULT   13 <corrupt>
     8: 000a2e68     0 NOTYPE  GLOBAL DEFAULT   11 <corrupt>

So the question is if TCF should be updated to ignore the section
.dynsym if it's broken in general, or perhaps if it can be ignored if
the ELF file is not a shared library?

Best regards,
Claes

----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



Back to the top