"Strong" stack protection for GCC
"Strong" stack protection for GCC
Posted Feb 15, 2014 22:39 UTC (Sat) by kleptog (subscriber, #1183)In reply to: "Strong" stack protection for GCC by PaXTeam
Parent article: "Strong" stack protection for GCC
It's always bugged me that CPUs have all sorts of flags (Carry, Overflow & Zero) yet they're not exposed at the C level. Not even as GCC builtins. There are tricks with pushf but they're workarounds.
To be fair, the C language doesn't make it easy since there's no nice syntax for returning multiple values. So you get alternatives like:
res = check_overflow_sadd(a, b, &overflow)
if(overflow)
error();
or
if(check_overflow_sadd(a,b))
error();
res = a+b;
neither of which are really nice. But there are many places where the carry and overflow bits could be used to simplify programs and make them more readable.
