提交 9e18308a 编写于 作者: M Michael Davidson 提交者: Greg Kroah-Hartman

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: NMichael Davidson <md@google.com>
Signed-off-by: NMatthias Kaehlcke <mka@chromium.org>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 073a457d
...@@ -69,7 +69,7 @@ void lkdtm_WARNING(void) ...@@ -69,7 +69,7 @@ void lkdtm_WARNING(void)
void lkdtm_EXCEPTION(void) void lkdtm_EXCEPTION(void)
{ {
*((int *) 0) = 0; *((volatile int *) 0) = 0;
} }
void lkdtm_LOOP(void) void lkdtm_LOOP(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册