> I am working on gcc 4.0.0. I want to use gcc to intercept each call to
> read, and taint the data readed in. For example:
> transform
>       read(fd, buf, size)
> to
>       read(fd, buf, size)
>       if(is_socket(fd))
>               taint(buf, size)

> So, what is the best suitable level to do this modification in gcc? My
> own thought is in finish_function, before calling c_genericize,as I
> discovered that in c front-end, there's no GENERIC tree... In
> c_genericize, it directly calls gimplify_function_tree.

You don't need to modify the compiler.  Just write your own read
function that taints the data and wrap it around calls to read using
ld's --wrap option.  See the linker documentation for more details.

Cheers, Ben


Reply via email to