]> git.ipfire.org Git - thirdparty/systemd.git/commit
fuzz: Introduce DO_NOT_OPTIMIZE
authorJan Janssen <medhefgo@web.de>
Fri, 23 Sep 2022 07:54:03 +0000 (09:54 +0200)
committerJan Janssen <medhefgo@web.de>
Sun, 25 Sep 2022 12:26:00 +0000 (14:26 +0200)
commit4b8eb86360b106afbc69cc014e8f1a15017c9d1f
tree7a485bb952d7da07c81318b567cb29b42c08b1d8
parente7508839afdd59619342a25c0c39c11fa934fd72
fuzz: Introduce DO_NOT_OPTIMIZE

The compiler may decide computations like these are not doing anything
and decide to optimize them away. This would defeat the whole fuzzing
exercise. This macro will force the compiler to materialize the value
no matter what. It should be less prone to accidents compared to using
log functions, which would either slow things down or still optimize the
value away (or simply move it into the if branch the log macros create).

The benefit over assert_se would be that no requirement is made on the
value itself. If we are fine getting a string of any size (including
zero), an assert_se would either create a noisy compiler warning about
conditions that would alawys be met or yet again optimize the whole
thing away.
src/boot/efi/fuzz-bcd.c
src/fuzz/fuzz.h