DynamoRIO / DynamoRIO/dynamorio

dr_get_proc_address() should exclude undefined symbols with non-zero values

Open
#341 1 comment 0 reactions 0 assignees View on GitHub
Component-API Migrated OpSys-Linux Priority-Medium
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

_From [derek.br...@gmail.com](https://code.google.com/u/117968039472581148324/) on August 26, 2010 16:50:36_

spec2k gcc for some reason has "free" with a value:
08048ec0 DF _UND_ 000000f4 GLIBC_2.0 free

this results in a positive result from dr_get_proc_address(), yet the
address is simply the PLT entry for the free import, which is misleading to
tools.

it's not clear the best way to exclude free here. compare vs libc:

symlookup 0x001e0000 libc.so.6 free
sym free info: bind=1, type=2, vis=0, idx=12, val=0x002532d0

symlookup 0x08048000 gcc free
sym free info: bind=1, type=2, vis=0, idx=0, val=0x08048ec0

not sure either idx makes sense: does idx=0 mean "not defined anywhere",
where idx=10 (plt) would mean "defined in plt" which is not the case?!?

libc:
10 .plt 00000080 001f6908 001f6908 00016908 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text 0010bb50 001f6990 001f6990 00016990 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 __libc_freeres_fn 000013ac 003024e0 003024e0 001224e0 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE

gcc:
0 .interp 00000013 08048114 08048114 00000114 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
...
10 .plt 00000360 08048c20 08048c20 00000c20 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text 001432a4 08048f80 08048f80 00000f80 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE

xref issue #76/PR 212458: ELF section iterator

is objdump checking the address for being in plt?
bind=1 meaning global for both, yet objdump only has g for libc
002532d0 g DF .text 00000112 GLIBC_2.0 free
08048ec0 DF _UND_ 000000f4 GLIBC_2.0 free

man objdump:
Next is the section with which the symbol is associated or _ABS_ if the
section is absolute (ie not connected with any section), or _UND_ if the
section is referenced in the file being dumped, but not defined there.

_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=341_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.