[guardian-dev] using -Werror=format-security
Jacob Appelbaum
jacob at appelbaum.net
Wed Dec 4 10:25:43 EST 2013
Abel Luck:
> -Werror=format-security
> "Once this flag is enabled, GCC will refuse to compile code that could be
> vulnerable to a string format security flaw."
>
> We should investigate adding this flag to our native builds, as well as other hardening
> flags. Not sure if it is available in the NDK though.
>
If you have a chance, I encourage you to look at the build hardening
we've done in tor and in other projects such as tlsdate:
https://github.com/ioerror/tlsdate/blob/master/configure.ac#L450
Basically, I suggest you add the following if your compiler supports
these options:
-D_FORTIFY_SOURCE=2 -fstack-protector-all
-fwrapv -fPIE -Wstack-protector
--param=ssp-buffer-size=1
Also, I suggest the following for your linker:
-z relro -z now
-pie
All the best,
Jake
More information about the Guardian-dev
mailing list