lkdtm: Prevent the compiler from optimising lkdtm_CORRUPT_STACK()
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 15 Nov 2016 07:02:32 +0000 (18:02 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Nov 2016 18:26:06 +0000 (19:26 +0100)
commitc55d240003ae253d3057dcf93510c9bd64bb7a09
treec80233dfdea2ba01b6a627fbe9cbc52a45df203c
parent967b274e02e18c9fbb4d19b96a89bd0afbc77b7a
lkdtm: Prevent the compiler from optimising lkdtm_CORRUPT_STACK()

At least on powerpc with GCC 6, the compiler is smart enough to optimise
lkdtm_CORRUPT_STACK() into an empty function that just returns.

If we print the buffer after we've written to it that prevents the
compiler from optimising away data and the memset().

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/lkdtm_bugs.c