Skip to content

Instantly share code, notes, and snippets.

@max-verem
Created March 28, 2017 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-verem/2421a6319c88691e24e7de7b92033cc8 to your computer and use it in GitHub Desktop.
Save max-verem/2421a6319c88691e24e7de7b92033cc8 to your computer and use it in GitHub Desktop.
blackmagic-10.8.5a4 under Fedora 25
--- blackmagic-10.8.5a4/blackmagic_lib.c.origin 2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-10.8.5a4/blackmagic_lib.c 2017-03-28 10:54:51.205782144 +0300
@@ -662,7 +662,16 @@
write = 0;
down_read(&current_task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+ if (current_task == current)
+ ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+ else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
+ ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL, NULL);
+#else
+ ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+#endif
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
if (current_task == current)
ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
else
--- blackmagic-io-10.8.5a4/bm_mm.c.origin 2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-io-10.8.5a4/bm_mm.c 2017-03-28 10:56:10.775912864 +0300
@@ -103,7 +103,16 @@
return false;
down_read(&task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+ if (current_task == current)
+ ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+ else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
+ ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL, NULL);
+#else
+ ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+#endif
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
if (task == current)
ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write, 0, umem->pages, NULL);
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment