tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Tests requiring MD hooks



On Tue, Jul 12, 2011 at 09:20:45AM -0700, Matt Thomas wrote:
> > 
> > I'm confused (not difficult these days!).
> > dlsym() returns 'void *', there is no separate dlsym_function_ptr() that
> > can return a 'fat' function pointer, or is the symbol attached to
> > something more akin to an x86 'call gate descriptor' - which is used
> > as the target of the call instruction?
> 
> On hppa and powerpc64, dlsym returns a pointer to function descriptor.
> On powerpc64, that contains a pointer to the function, a pointer to its TOC 
> (GOT),
> and a pointer to an environment address (not used in C).

I suspect that means that casting a char[] to (*)(void) isn't going to have
the desired effect.

I suspect that means the code will require a MD #define to convert the
function pointer (returned by dlsym) into the address that must be 
passed to mprotect() to remove execute permission.
For most archs this will just return the actual address.
It might even be necessary to pass the address of the function pointer!

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index