BUILD/BUG: enable -fno-strict-overflow by default
authorWilly Tarreau <w@1wt.eu>
Tue, 20 Mar 2018 15:46:46 +0000 (16:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Mar 2018 16:17:27 +0000 (17:17 +0100)
commitcde05c85ef3da3c54b79d7ad3570d0e13ebd620c
tree256b6faf2ba05358f7fc93e6dfbe5442c65a7326
parentc98aebcdb8f1d21a1a3501bab91e1d702171395e
BUILD/BUG: enable -fno-strict-overflow by default

Some time ago, integer overflows detection stopped working in the timer
code on recent compliers and were addressed by commit 73bdb32 ("BUG/MAJOR:
Use -fwrapv."). By then it was thought that -fno-strict-overflow was not
needed as implied, but it resulted from a misinterpretation of the doc,
as this one is still needed to disable pointer overflow optimization that
is automatically enabled at -O2/-O3/-Os.

Unfortunately the compiler happily removes overflow checks without the
slightest warning so it's not trivial to guess the extent of this issue
without comparing the emitted asm code. By checking the emitted assembly
code with and without the option, it was found that the only affected
location was the reported one, in ssl_sock_parse_clienthello(), where
the test can never fail on any system where the highest userland pointer
is at least 64kB away from wrapping (ie all 32/64 bit OS in field), so
there it is harmless.

This patch must be backported to all maintained versions.

Special thanks to Ilya Shipitsin for reporting this issue.
Makefile