Ryan Hill <[email protected]> wrote: > Martin Vaeth <[email protected]> wrote: >> > >> > * -fstack-protector{-all} >> > No thank you. -fstack-protector has very limited coverage >> >> I'd say it covers most cases where bugs can be made, [...] > > The numbers I've seen show a maximum of 5% coverage for code that has a > large number of functions containing char arrays on the stack.
If you have no local array on the stack, it is rather hard to write accidentally(!) code in the function which corrupts the stack. (It still is possible e.g. through bad casting, but it is rather unlikely that this happens by accident). So coverage of these functions covers most cases of accidental bugs. Of course, as Ciaranm already mentioned, there is no compiler flag which transforms unsafe code into safe one, but if even just one or two security bugs can be avoid this way, it was worth to add this flag IMHO. > Most code doesn't fall into that category. Isn't this good news? It means most code will not get *any* penalty with -fstack-protector.
