Created
February 28, 2017 05:33
-
-
Save nanpuyue/d6fccf18d11ee3030ba935ae86cfe437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com | |
# date: 2017-2-28 | |
[[ $(id -u) = 0 ]] || { | |
echo "Please run this script as root !" | |
exit -1 | |
} | |
cd /usr/lib/vmware/modules/source || exit -1 | |
tar xf vmmon.tar && mv -v vmmon.tar{,.bak} | |
tar xf vmnet.tar && mv -v vmnet.tar{,.bak} | |
patch -N --merge --no-backup-if-mismatch -p0 << "EOF" | |
--- vmmon-only/linux/hostif.c 2016-11-12 15:15:51.000000000 +0800 | |
+++ vmmon-only/linux/hostif.c 2017-02-28 12:59:59.350183370 +0800 | |
@@ -1160,11 +1160,13 @@ | |
unsigned int numPages) // IN | |
{ | |
int retval; | |
down_read(¤t->mm->mmap_sem); | |
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) | |
+ retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL); | |
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) | |
retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL); | |
#else | |
retval = get_user_pages(current, current->mm, (unsigned long)uvAddr, | |
numPages, 0, 0, ppages, NULL); | |
#endif | |
--- vmnet-only/userif.c 2016-11-12 15:15:55.000000000 +0800 | |
+++ vmnet-only/userif.c 2017-02-28 12:58:53.826792776 +0800 | |
@@ -111,11 +111,13 @@ | |
{ | |
struct page *page = NULL; | |
int retval; | |
down_read(¤t->mm->mmap_sem); | |
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) | |
+ retval = get_user_pages(addr, 1, 0, &page, NULL); | |
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) | |
retval = get_user_pages(addr, 1, 1, 0, &page, NULL); | |
#else | |
retval = get_user_pages(current, current->mm, addr, | |
1, 1, 0, &page, NULL); | |
#endif | |
EOF | |
tar cf vmmon.tar vmmon-only && rm -rf vmmon-only | |
tar cf vmnet.tar vmnet-only && rm -rf vmnet-only | |
vmware-modconfig --console --install-all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment