The man page here(https://man7.org/linux/man-pages/man7/feature_test_macros.7.html), says "With _FORTIFY_SOURCE set to 2, some more checking is added, but some conforming programs might fail." Is there any example on Ubuntu 20.01 that confirms or validates this?
Asked
Active
Viewed 153 times
0
-
1. Search google for `_FORTIFY_SOURCE` ; 2. click on the second answer : [_FORTIFY_SOURCE: explained](https://p0lycarp.github.io/2019/fortify/) ; read it ; done. – Valery S. May 11 '22 at 09:39
-
Thanks Valery S. The question was after doing some basic searches. I have read (rather checked) the code that is mentioned in the link you shared already. It does work (except that the result slightly differs from what is mentioned in link for FORTIFY_SOURCE=2. And that is due to stack-protection enabled by default in gcc Ubuntu 20.01 - checksec.sh confirms stack-protection is enabled. I may be wrong, but I acknowledge that the article was written in 2019). But, I was looking for some more examples with WHY and WHEN just to be sure. That is something that I may be missing in my search. – user3559225 May 11 '22 at 10:12
-
You're welcome ; It's all about program hardening ; this [SO](https://stackoverflow.com/questions/13517526/difference-between-gcc-d-fortify-source-1-and-d-fortify-source-2) could shed some light on this. – Valery S. May 11 '22 at 11:08