kunit/fortify: Replace "volatile" with OPTIMIZER_HIDE_VAR()
authorKees Cook <kees@kernel.org>
Wed, 12 Mar 2025 00:04:40 +0000 (17:04 -0700)
committerKees Cook <kees@kernel.org>
Wed, 12 Mar 2025 20:24:01 +0000 (13:24 -0700)
commit6ee149f61bcce39692f0335a01e99355d4cec8da
treeb317902f423708bf644ae373b4254970361aded1
parent416cf1f4d91bf52305cd160a382273ccef980b7f
kunit/fortify: Replace "volatile" with OPTIMIZER_HIDE_VAR()

It does seem that using "volatile" isn't going to be sane compared to
using OPTIMIZER_HIDE_VAR() going forward. Some strange interactions[1]
with the sanitizers have been observed in the self-test code, so replace
the logic.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://github.com/ClangBuiltLinux/linux/issues/2075 [1]
Link: https://lore.kernel.org/r/20250312000439.work.112-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
lib/tests/fortify_kunit.c