]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Add support for ELF indirect functions. These are symbols of
authorTom Hughes <tom@compton.nu>
Thu, 29 Oct 2009 09:27:11 +0000 (09:27 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 29 Oct 2009 09:27:11 +0000 (09:27 +0000)
commit00d987f91a612de5a56055d1bdb7f2cce9e1c4a8
treebc63d4e345f0bab9d82902f5003f8afb451e9b14
parentc8d8e1fd8611b84a12dcb65a2fa6281678f51c7a
Add support for ELF indirect functions. These are symbols of
type STT_GNU_IFUNC which, instead of pointing directly at the
function, point at a routine which will return the address of
the real function. Redirection of indirect functions is handled
by valgrind as follows:

  - When a redirection specification matches an indirect
    function symbol an active redirection is added in the
    normal way, but with the isIFunc flag set.

  - When a call is made to an address which matches an
    active redirection with the isIFunc flag set the call
    is redirected, but not to the target address of the
    redirection - instead it is sent to a small wrapper
    routine that is preloaded into the client.

  - The wrapper routine calls the original client routine
    and collects the result, which it reports to valgrind
    using a client request, and then returns the result to
    the caller.

  - When valgrind gets the client request it looks up the
    active redirection for the indirect function and then
    adds a new active redirection which redirects from the
    address returned by the indirection function to the
    redirection target. This new redirection does not have
    the isIFunc flag set so behaves as a normal redirection.

In addition to the above we also add a few new redirections to
memcheck to capture internal calls made by glibc to things like
strlen, as these internal calls do not go through the indirect
function and instead go direct to the chosen implementation.

Based on a patch from Dodji Seketeli and comments from Jakub
Jelinek, this commit closes bug 206013.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10920
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/priv_storage.h
coregrind/m_debuginfo/readelf.c
coregrind/m_redir.c
coregrind/m_scheduler/scheduler.c
coregrind/pub_core_clreq.h
coregrind/pub_core_redir.h
coregrind/vg_preloaded.c
include/pub_tool_debuginfo.h
memcheck/mc_replace_strmem.c