misc: lkdtm: Add volatile to intentional NULL pointer reference

Add a volatile qualifier where a NULL pointer is deliberately
dereferenced to trigger a panic.

Without the volatile qualifier clang will issue the following warning:
"indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]" and replace the pointer reference
with a __builtin_trap() (which generates a ud2 instruction on x86_64).

Signed-off-by: Michael Davidson <md@google.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Michael Davidson 2017-04-14 14:15:09 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель 073a457d9e
Коммит 9e18308a5d
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -69,7 +69,7 @@ void lkdtm_WARNING(void)
void lkdtm_EXCEPTION(void)
{
*((int *) 0) = 0;
*((volatile int *) 0) = 0;
}
void lkdtm_LOOP(void)