From: Thierry Reding Date: Tue, 22 Sep 2015 21:58:52 +0000 (-0700) Subject: userfaultfd: selftests: vm: pick up sanitized kernel headers X-Git-Tag: v4.1.12-92~16^2~24 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=93debad18fc51cfcd5ad8e4ff57e43c2f99fde02;p=users%2Fjedix%2Flinux-maple.git userfaultfd: selftests: vm: pick up sanitized kernel headers Orabug: 21685254 Add the usr/include subdirectory of the top-level tree to the include path, and make sure to include headers without relative paths to make sure the sanitized headers get picked up. Otherwise the compiler will not be able to find the linux/compiler.h header included by the non- sanitized include/uapi/linux/userfaultfd.h. While at it, make sure to only hardcode the syscall numbers on x86 and PowerPC if they haven't been properly picked up from the headers. Signed-off-by: Thierry Reding Acked-by: Michael Ellerman Cc: Shuah Khan Signed-off-by: Andrea Arcangeli Cc: Dr. David Alan Gilbert Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit d0a871141d07929b559f5eae9c3fc4b63d16866b) Signed-off-by: Mike Kravetz Reviewed-by: Dhaval Giani Conflicts: tools/testing/selftests/vm/Makefile Signed-off-by: Dhaval Giani --- diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index f0e120ca84177..512149e8c62ba 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -1,6 +1,6 @@ # Makefile for vm selftests -CFLAGS = -Wall +CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) BINARIES = hugepage-mmap hugepage-shm map_hugetlb thuge-gen hugetlbfstest BINARIES += transhuge-stress BINARIES += userfaultfd diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 2c7cca6f26a45..62bc39f996d24 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -64,8 +64,9 @@ #include #include #include -#include "../../../../include/uapi/linux/userfaultfd.h" +#include +#ifndef __NR_userfaultfd #ifdef __x86_64__ #define __NR_userfaultfd 323 #elif defined(__i386__) @@ -75,6 +76,7 @@ #else #error "missing __NR_userfaultfd definition" #endif +#endif static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;