Re: Turning on stack protection by default
Antti Kantee <pooka <at> cs.hut.fi>
2009-10-24 14:44:44 GMT
On Fri Oct 23 2009 at 09:20:42 +0100, Matthias Scheler wrote:
> On Fri, Oct 23, 2009 at 01:47:54AM +0100, Mindaugas Rasiukevicius wrote:
> > > Considering that this feature helps finding bugs and increases system
> > > security I would like to suggest to turn in on by default on these
> > > two NetBSD ports.
> >
> > Can you provide some numbers how it affects performance?
>
> I've attached a little test program which is very recursive.(*)
> Where are the results on my NetBSD/amd64 5.0_STABLE system
> which is driven by a ?Xen 3040 CP running at 1.83GHz:
>
> tron <at> colwyn:~>gcc fib.c -Wall -O2 -o fib
> tron <at> colwyn:~>time ./fib 42
> 42 -> 267914296
> ./fib 42 14.07s user 0.00s system 99% cpu 14.119 total
> tron <at> colwyn:~>gcc fib.c -fstack-protector-all -Wstack-protector -Wall -O2 -o fib
> tron <at> colwyn:~>time ./fib 42
> 42 -> 267914296
> ./fib 42 15.07s user 0.00s system 98% cpu 15.261 total
>
> That is 8% overhead in a program which I believe gets affected particular
> bad by enabling stack protection.
>
> Kind regards
>
> (*) Yes, this can be done much more efficient. The program is written
> to defeat some of GCC's optimisations and to enforce stack protection.
Hi,
(Continue reading)