In article <20110208210049.ga8...@britannica.bec.de>, Joerg Sonnenberger <jo...@britannica.bec.de> wrote: >On Tue, Feb 08, 2011 at 03:34:54PM -0500, Christos Zoulas wrote: >> Still the problem remains, how do we stack the calls to insert the ssp >> check at the top level, without resorting to rtld tricks? > >Let me try to summarize the situation to make sure I get it right: > >The fortification code wants to provide an inline function "read" that >calls the real "read" after doing the argument checks. > >rumphijack wants to override the "read" symbol, apply some magic and >call "_sys_read" for the real system call.
Yes. >To get the layering correct, we could make the fortification code define >another prototype and use double rename, e.g. > >ssize_t __real_read(int __fd, ...) __RENAME(read); > >__ssp_inline ssize_t read(int __fd, ...) __RENAME(__ssp_read); > >__sso_inline ssize_t read(int __fd, ...) { > __ssp_check(__buf, __lean, bos); > return __real_read(__fd, ...); >} Yes, that would work. An extra level of indirection always works. christos