linux/drivers/misc/lkdtm
Brendan Higgins 9e62f296db lkdtm/bugs: fix build error in lkdtm_UNSET_SMEP
[ Upstream commit 0e31e3573f ]

When building ARCH=um with CONFIG_UML_X86=y and CONFIG_64BIT=y we get
the build errors:

drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_UNSET_SMEP’:
drivers/misc/lkdtm/bugs.c:288:8: error: implicit declaration of function ‘native_read_cr4’ [-Werror=implicit-function-declaration]
  cr4 = native_read_cr4();
        ^~~~~~~~~~~~~~~
drivers/misc/lkdtm/bugs.c:290:13: error: ‘X86_CR4_SMEP’ undeclared (first use in this function); did you mean ‘X86_FEATURE_SMEP’?
  if ((cr4 & X86_CR4_SMEP) != X86_CR4_SMEP) {
             ^~~~~~~~~~~~
             X86_FEATURE_SMEP
drivers/misc/lkdtm/bugs.c:290:13: note: each undeclared identifier is reported only once for each function it appears in
drivers/misc/lkdtm/bugs.c:297:2: error: implicit declaration of function ‘native_write_cr4’; did you mean ‘direct_write_cr4’? [-Werror=implicit-function-declaration]
  native_write_cr4(cr4);
  ^~~~~~~~~~~~~~~~
  direct_write_cr4

So specify that this block of code should only build when
CONFIG_X86_64=y *AND* CONFIG_UML is unset.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20191213003522.66450-1-brendanhiggins@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 21:22:46 +00:00
..
Makefile lkdtm: Add Control Flow Integrity test 2019-08-12 15:28:51 -07:00
bugs.c lkdtm/bugs: fix build error in lkdtm_UNSET_SMEP 2020-02-05 21:22:46 +00:00
cfi.c lkdtm: Add Control Flow Integrity test 2019-08-12 15:28:51 -07:00
core.c lkdtm: Split WARNING into separate tests 2019-08-19 11:13:21 -07:00
heap.c lkdtm/heap: add tests for freelist hardening 2019-07-12 11:05:41 -07:00
lkdtm.h lkdtm: Split WARNING into separate tests 2019-08-19 11:13:21 -07:00
perms.c lkdtm: Add tests for NULL pointer dereference 2019-01-09 12:00:31 -08:00
refcount.c
rodata.c
stackleak.c lkdtm: Add a test for STACKLEAK 2018-09-04 10:35:47 -07:00
usercopy.c lkdtm/usercopy: Moves the KERNEL_DS test to non-canonical 2019-04-07 10:38:31 -07:00