This kernel API is undergoing considerable flux.
output_exportconf(s, o, "get_user_pages_remote", "STAPCONF_GET_USER_PAGES_REMOTE");
output_autoconf(s, o, "autoconf-get_user_pages_remote-flags.c",
"STAPCONF_GET_USER_PAGES_REMOTE_FLAGS", NULL);
+ output_autoconf(s, o, "autoconf-get_user_pages_remote-flags_locked.c",
+ "STAPCONF_GET_USER_PAGES_REMOTE_FLAGS_LOCKED", NULL);
o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl;
void *maddr;
#ifdef STAPCONF_GET_USER_PAGES_REMOTE
-#ifdef STAPCONF_GET_USER_PAGES_REMOTE_FLAGS
+#if defined(STAPCONF_GET_USER_PAGES_REMOTE_FLAGS_LOCKED)
+ unsigned int flags = FOLL_FORCE;
+ if (write)
+ flags |= FOLL_WRITE;
+ ret = get_user_pages_remote (tsk, mm, addr, 1, flags, &page, &vma, NULL);
+#elif defined(STAPCONF_GET_USER_PAGES_REMOTE_FLAGS)
unsigned int flags = FOLL_FORCE;
if (write)
flags |= FOLL_WRITE;
ret = get_user_pages_remote (tsk, mm, addr, 1, flags, &page, &vma);
-#else /* !STAPCONF_GET_USER_PAGES_REMOTE_FLAGS */
- ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
-#endif /* !STAPCONF_GET_USER_PAGES_REMOTE_FLAGS */
#else
+ ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
+#endif
+#else /* !STAPCONF_GET_USER_PAGES_REMOTE* */
ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
#endif
if (ret <= 0)
--- /dev/null
+#include <linux/mm.h>
+
+//
+// The following kernel commit changed the get_user_pages_remote()
+// function signature:
+//
+// commit 5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
+// Author: Lorenzo Stoakes <lstoakes@gmail.com>
+// Date: Wed Dec 14 15:06:52 2016 -0800
+//
+// mm: add locked parameter to get_user_pages_remote()
+//
+// This changed the function signature from:
+//
+// long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
+// unsigned long start, unsigned long nr_pages,
+// unsigned int gup_flags, struct page **pages,
+// struct vm_area_struct **vmas);
+//
+// long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
+// unsigned long start, unsigned long nr_pages,
+// unsigned int gup_flags, struct page **pages,
+// struct vm_area_struct **vmas, int *locked);
+//
+
+long gupr_wrapper2(struct task_struct *tsk, struct mm_struct *mm,
+ unsigned long start, unsigned long nr_pages,
+ unsigned int gup_flags, struct page **pages,
+ struct vm_area_struct **vmas, int *locked)
+{
+ return get_user_pages_remote(tsk, mm, start, nr_pages, gup_flags,
+ pages, vmas, locked);
+}