diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2011-07-24 01:19:13 -0700 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2011-07-27 09:40:24 +0200 |
commit | a2f827c7c28c955ad49b32909452e42ccfc5e5c1 (patch) | |
tree | 6da4313f89a4308e1c7ee1151a92ab210301d954 /ldso/include/dl-elf.h | |
parent | 2d4243ce60bcd7a9f64c2ce670bc456f2c7da708 (diff) |
ldso/mips: dlsym() incorrectly matches undefined symbols
check_match() relies on checking for (sym->st_value == 0) to see if the
symbol is undefined. This works reasonably well on most architectures,
such as ARM or i386:
$ readelf -s /lib32/libcap.so.2 | grep -E "\<malloc\>"
17: 00000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.0 (2)
However, on MIPS, libbfd puts nonzero data in the st_value field to
facilitate resetting the symbol's GOT entry if the library that defines
the symbol gets unloaded:
$ mipsel-linux-readelf -s libfoo.so | grep -E "\<malloc\>"
74: 00003140 0 FUNC GLOBAL DEFAULT UND malloc
This can cause check_match to report a false positive when examining the
external symbol reference. Consequently dlsym() will return a bad pointer
to the caller.
Use the special MIPS logic from glibc-ports-2.13 to avoid this situation.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'ldso/include/dl-elf.h')
0 files changed, 0 insertions, 0 deletions