File systemtap-update-runtime-linux-access_process_vm.h.patch of Package systemtap

From: David Smith <dsmith@redhat.com>
Date: Mon Apr 25 10:02:36 2016 -0500
Subject: Fix PR19990 by updating runtime/linux/access_process_vm.h
Git-commit: e7c42c3a9fa0c442ae59a15ccf256224c27ef745
References: bsc#1031409
Signed-off-by: Tony Jones <tonyj@suse.de>

    Fix PR19990 by updating runtime/linux/access_process_vm.h.
    
    * runtime/linux/access_process_vm.h (__access_process_vm_): Use
      get_user_pages_remote() when available.
    * buildrun.cxx (compile_pass): Added export test for
      'get_user_pages_remote()'.

diff --git a/buildrun.cxx b/buildrun.cxx
index cac46d42f..30082ac84 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -455,6 +455,7 @@ compile_pass (systemtap_session& s)
 		  "STAPCONF_MODULE_LAYOUT", NULL);
   output_autoconf(s, o, "autoconf-mod_kallsyms.c",
 		  "STAPCONF_MOD_KALLSYMS", NULL);
+  output_exportconf(s, o, "get_user_pages_remote", "STAPCONF_GET_USER_PAGES_REMOTE");
 
   o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl;
 
diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h
index a2114c60d..214d4e254 100644
--- a/runtime/linux/access_process_vm.h
+++ b/runtime/linux/access_process_vm.h
@@ -32,7 +32,11 @@ __access_process_vm_ (struct task_struct *tsk, unsigned long addr, void *buf,
       int bytes, ret, offset;
       void *maddr;
 
+#ifdef STAPCONF_GET_USER_PAGES_REMOTE
+      ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
+#else
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
+#endif
       if (ret <= 0)
 	break;
 
openSUSE Build Service is sponsored by