aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-09-22 17:58:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-22 18:09:53 -0400
commitd0a871141d07929b559f5eae9c3fc4b63d16866b (patch)
treec95744ddbdd52b3695618e93290cb1f113484ad8
parentac5be6b47e8bd25b62bed2c82cda7398999f59e9 (diff)
userfaultfd: selftests: vm: pick up sanitized kernel headers
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 <treding@nvidia.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Cc: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--tools/testing/selftests/vm/Makefile2
-rw-r--r--tools/testing/selftests/vm/userfaultfd.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index d36fab7d8ebd..949e275f11a6 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,6 +1,6 @@
1# Makefile for vm selftests 1# Makefile for vm selftests
2 2
3CFLAGS = -Wall 3CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
4BINARIES = compaction_test 4BINARIES = compaction_test
5BINARIES += hugepage-mmap 5BINARIES += hugepage-mmap
6BINARIES += hugepage-shm 6BINARIES += hugepage-shm
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 7c1d958857d2..59d145f20918 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -64,8 +64,9 @@
64#include <sys/syscall.h> 64#include <sys/syscall.h>
65#include <sys/ioctl.h> 65#include <sys/ioctl.h>
66#include <pthread.h> 66#include <pthread.h>
67#include "../../../../include/uapi/linux/userfaultfd.h" 67#include <linux/userfaultfd.h>
68 68
69#ifndef __NR_userfaultfd
69#ifdef __x86_64__ 70#ifdef __x86_64__
70#define __NR_userfaultfd 323 71#define __NR_userfaultfd 323
71#elif defined(__i386__) 72#elif defined(__i386__)
@@ -77,6 +78,7 @@
77#else 78#else
78#error "missing __NR_userfaultfd definition" 79#error "missing __NR_userfaultfd definition"
79#endif 80#endif
81#endif
80 82
81static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; 83static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
82 84