clean up and simplify preloading #37

Closed
robgjansen opened this Issue Jan 21, 2012 · 0 comments

Projects

None yet

1 participant

Owner

When we preload functions, we use dlsym() to lookup our intercepted function, and the system functions if we are not wanting to intercept it.

This could be done a little differently to make things smoother:

  1. The preload lib calls into shadow, e.g. shadow_getInterceptedFunctions(), to obtain a structure of pointers to all of our intercepted functions. This would require preload to do a lookup for "shadow_getInterceptedFunctions", but once it does that it never calls dlsym again. It can save the pointer and use this structure to make future calls.
  2. For cases where we want to call the system version of a function, we can use syscall(), using the IDs from /usr/include/bits/syscall.h. This way we avoid storing pointers to everything.

This new approach should drastically simplify the process of finding the correct function to call, and should make the preload library cleaner and could be made to work for multiple threads.

@robgjansen robgjansen was assigned Jul 1, 2013
@robgjansen robgjansen added a commit that referenced this issue Jul 3, 2013
@robgjansen robgjansen we now intercept all mem alloc functions without segfaults
for now, i separated the memory preload functions into its own
file. that will eventually merge back in with preload.c after
moving all funcs  to the cleaner preload design as part of #37.

there are still a number of pointers that we are not tracking
or tracking incorrectly. more analysis needed there.

refs #37, refs #144
def5310
@robgjansen robgjansen closed this in fe885d3 Jul 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment