]> sourceware.org Git - systemtap.git/commitdiff
Fix get_user_pages_remote() test for 4.10-rc0 kernels.
authorFrank Ch. Eigler <fche@redhat.com>
Mon, 26 Dec 2016 15:39:09 +0000 (10:39 -0500)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 26 Dec 2016 15:39:09 +0000 (10:39 -0500)
This kernel API is undergoing considerable flux.

buildrun.cxx
runtime/linux/access_process_vm.h
runtime/linux/autoconf-get_user_pages_remote-flags_locked.c [new file with mode: 0644]

index f5019b9254d78960e5dbd0552539c2433b5e87b6..aaea64cb1d306f42e63705313e4818498d726b64 100644 (file)
@@ -450,6 +450,8 @@ compile_pass (systemtap_session& s)
   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;
 
index d9400d723081b4c5653ae77e70b5a850c63bad06..22a12207aa5ceada97c8110c5d68f7121b0d72d2 100644 (file)
@@ -33,15 +33,20 @@ __access_process_vm_ (struct task_struct *tsk, unsigned long addr, void *buf,
       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)
diff --git a/runtime/linux/autoconf-get_user_pages_remote-flags_locked.c b/runtime/linux/autoconf-get_user_pages_remote-flags_locked.c
new file mode 100644 (file)
index 0000000..bb9b567
--- /dev/null
@@ -0,0 +1,33 @@
+#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);
+}
This page took 0.047442 seconds and 5 git commands to generate.