writing mudflap wrappers

Frank Ch. Eigler fche@redhat.com
Tue Apr 22 17:45:00 GMT 2003


Hi -


On Wed, Apr 23, 2003 at 02:11:41AM +1000, Eyal Lebedinsky wrote:
> [...] I found
> that some file handles are static (stdin etc.) and cannot be checked
> without first being registered (somewhere in the init code?). 

Yes, these streams should probably be dealt with during libmudflap
startup.  Another alternative is to do one-time manual registration
when the first f* function is intercepted.


> Moreover, registering fopen() results is wrong - it seems that libc
> allocates it dynamically and the hooks pick it up. So now I need to
> find a way to unregister this memory so that any use of the file
> handle will trigger an error, and I want this even when libs did
> not actually free the area.

Maybe this scenario is not important enough to justify too much
mechanism.  If fclose() doesn't immediately free stuff that fopen()
allocated, one might live with the memory access bugs this could hide.


> [...] Does mf accept multiple registration of memory?

Multiple duplicate registrations are sometimes permitted.  There is
not much logic behind this yet, awaiting precisely this sort of
experimentation.


> A final question. I am developing on Linux/i386. The wrappers
> I write are correct for this platform, but I do not know that all
> will work on other platforms. How should I protect the wrappers?
> [...]

Clearly, it should be as platform-independent as possible.
You can use autoconf for other parts.


- FChE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20030422/98b0d27e/attachment.sig>


More information about the Gcc mailing list