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>
This commit is contained in:
Thierry Reding 2015-09-22 14:58:52 -07:00 коммит произвёл Linus Torvalds
Родитель ac5be6b47e
Коммит d0a871141d
2 изменённых файлов: 4 добавлений и 2 удалений

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

@ -1,6 +1,6 @@
# Makefile for vm selftests # Makefile for vm selftests
CFLAGS = -Wall CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
BINARIES = compaction_test BINARIES = compaction_test
BINARIES += hugepage-mmap BINARIES += hugepage-mmap
BINARIES += hugepage-shm BINARIES += hugepage-shm

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

@ -64,8 +64,9 @@
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <pthread.h> #include <pthread.h>
#include "../../../../include/uapi/linux/userfaultfd.h" #include <linux/userfaultfd.h>
#ifndef __NR_userfaultfd
#ifdef __x86_64__ #ifdef __x86_64__
#define __NR_userfaultfd 323 #define __NR_userfaultfd 323
#elif defined(__i386__) #elif defined(__i386__)
@ -77,6 +78,7 @@
#else #else
#error "missing __NR_userfaultfd definition" #error "missing __NR_userfaultfd definition"
#endif #endif
#endif
static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;