Stack Smashing Protector: Difference between revisions

m
→‎Usage: clarify the the optimization level is meant
[unchecked revision][unchecked revision]
(→‎Usage: Some more information :))
m (→‎Usage: clarify the the optimization level is meant)
Line 89:
* Use the libssp implementation that comes with GCC.
 
It should also be noted that with the optimisations enabled via <tt>-ONO<n></tt> in GCC, the compiler may or may not "inline" a function. If a function has been inlined, then '''stack smash protection will not work for that function.''' To prevent this, one must use the <tt>noinline</tt> attribute like so:
<source lang="c">
void __attribute__ ((noinline)) foo( /* args */ )
Line 97:
</source>
 
Disabling inlining in GCC can be done with the <tt>-fno-inline</tt> compile flag, however, that will not inline functions with the <tt>inline</tt> attribute. The <tt>-fno-inline-functions</tt> will not inline functions optimised with <tt>-ONO<n></tt>; but that has been proven ineffective for GCC versions 3.4.5 and over ([https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28120 see bug report]).
 
If any tests do not work when trying to trip the protective mechanism, this may be the reason why it does not work!
Anonymous user