summarylogtreecommitdiffstats
path: root/vmmon.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vmmon.patch')
-rw-r--r--vmmon.patch216
1 files changed, 66 insertions, 150 deletions
diff --git a/vmmon.patch b/vmmon.patch
index 40fd37b85c3..16dc1755c71 100644
--- a/vmmon.patch
+++ b/vmmon.patch
@@ -12,6 +12,29 @@
# Header directory for the running kernel
ifdef LINUXINCLUDE
+@@ -100,6 +104,13 @@ auto-build: $(DRIVER_KO)
+ $(DRIVER): $(DRIVER_KO)
+ if [ $< -nt $@ ] || [ ! -e $@ ] ; then cp -f $< $@; fi
+
++# Use SUBDIRS on 2.x, 3.x, 4.x. Use M on newer kernels.
++ifeq ($(filter-out 2 3 4,$(firstword $(subst ., ,$(VM_UNAME)))),)
++DIRVAR := SUBDIRS
++else
++DIRVAR := M
++endif
++
+ # Pass gcc version down the chain, so we can detect if kernel attempts to use unapproved compiler
+ VM_CCVER := $(VMCCVER)
+ export VM_CCVER
+@@ -117,7 +128,7 @@ prebuild:: ;
+ postbuild:: ;
+
+ $(DRIVER_KO): prebuild
+- $(MAKE) -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
++ $(MAKE) -C $(BUILD_DIR) $(DIRVAR)=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
+ MODULEBUILDDIR=$(MODULEBUILDDIR) modules
+ $(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
+ MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
--- a/vmmon/linux/driver.c
+++ b/vmmon/linux/driver.c
@@ -80,6 +80,16 @@
@@ -31,6 +54,17 @@
/*
*----------------------------------------------------------------------
+@@ -104,7 +114,9 @@ long LinuxDriver_Ioctl(struct file *filp, u_int iocmd,
+
+ static int LinuxDriver_Close(struct inode *inode, struct file *filp);
+ static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
++static vm_fault_t LinuxDriverFault(struct vm_fault *fault);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ static int LinuxDriverFault(struct vm_fault *fault);
+ #elif defined(VMW_NOPAGE_2624)
+ static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
@@ -115,7 +115,7 @@
#endif
static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
@@ -97,6 +131,20 @@
{
LinuxDriverWakeUp(FALSE);
}
+@@ -884,7 +904,12 @@ LinuxDriver_Close(struct inode *inode, // IN
+ */
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+-static int
++static
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
++vm_fault_t
++#else
++int
++#endif
+ LinuxDriverFault(struct vm_fault *fault) //IN/OUT
+ #elif defined(VMW_NOPAGE_2624)
+ static int LinuxDriverFault(struct vm_area_struct *vma, //IN
--- a/vmmon/linux/hostif.c
+++ b/vmmon/linux/hostif.c
@@ -1164,16 +1172,7 @@
@@ -291,65 +339,7 @@
mod_timer(&uptimeState.timer, jiffies + HZ);
}
-@@ -3572,7 +3625,12 @@
-
- ASSERT(handle);
-
-- if (!access_ok(VERIFY_WRITE, p, size)) {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
-+ if (!access_ok(VERIFY_WRITE, p, size))
-+#else
-+ if (!access_ok(p, size))
-+#endif
-+ {
- printk(KERN_ERR "%s: Couldn't verify write to uva 0x%p with size %"
- FMTSZ"u\n", __func__, p, size);
-
-From 8ba37a5023f939ba8d2e0d91b916ff442b1c18dd Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Mon, 31 Dec 2018 00:05:42 +0100
-Subject: [PATCH] modules: replace SUBDIRS with M
-
-Since commit 0126be38d988 ("kbuild: announce removal of SUBDIRS if used")
-in v5.0-rc1, using SUBDIRS when building out of tree modules produces
-a deprecation warning. As M used to work since pretty much ever, use it
-unconditionally.
----
- vmmon-only/Makefile | 2 +-
- vmnet-only/Makefile | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/vmmon-only/Makefile b/vmmon-only/Makefile
-index ccdd295..b4b71fb 100644
---- a/vmmon-only/Makefile
-+++ b/vmmon-only/Makefile
-@@ -121,7 +121,7 @@ prebuild:: ;
- postbuild:: ;
-
- $(DRIVER_KO): prebuild
-- $(MAKE) -C $(BUILD_DIR) SUBDIRS=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
-+ $(MAKE) -C $(BUILD_DIR) M=$$PWD SRCROOT=$$PWD/$(SRCROOT) \
- MODULEBUILDDIR=$(MODULEBUILDDIR) modules
- $(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
- MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
-From 41413a9b6e660a93600a438944d85b6f51eb680c Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Tue, 5 Mar 2019 13:21:35 +0100
-Subject: [PATCH] vmmon: use KERNEL_DS rather than get_ds()
-
-Commit 736706bee329 ("get rid of legacy 'get_ds()' function") in v5.1-rc1
-removed get_ds() helper. As this helper always returned KERNEL_DS on x86_64
-since the architecture was introduced (and even on i386, it did so since
-v2.1.0), simply use KERNEL_DS regardless of kernel version.
----
- vmmon-only/linux/hostif.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
-index ef88a22..8ca17de 100644
---- a/vmmon-only/linux/hostif.c
-+++ b/vmmon-only/linux/hostif.c
-@@ -2304,7 +2304,7 @@ isVAReadable(VA r) // IN:
+@@ -2251,7 +2304,7 @@ isVAReadable(VA r) // IN:
int ret;
old_fs = get_fs();
@@ -358,7 +348,7 @@ index ef88a22..8ca17de 100644
r = APICR_TO_ADDR(r, APICR_VERSION);
ret = HostIF_CopyFromUser(&dummy, (void*)r, sizeof(dummy));
set_fs(old_fs);
-@@ -2505,7 +2505,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN:
+@@ -2452,7 +2505,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN:
}
old_fs = get_fs();
@@ -367,7 +357,7 @@ index ef88a22..8ca17de 100644
{
struct poll_wqueues table;
-@@ -2634,7 +2634,7 @@ HostIF_SemaphoreSignal(uint64 *args) // IN:
+@@ -2581,7 +2634,7 @@ HostIF_SemaphoreSignal(uint64 *args) // IN:
}
old_fs = get_fs();
@@ -376,99 +366,25 @@ index ef88a22..8ca17de 100644
/*
* Always write sizeof(uint64) bytes. This works fine for eventfd and
-From 48812705d760a0dc760420ce495e34ce4d019b92 Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Sat, 9 Mar 2019 11:11:29 +0100
-Subject: [PATCH] vmmon: fix return type of vm_operations_struct::fault handler
-
-Commit 3d3539018d2c ("mm: create the new vm_fault_t type") in mainline
-5.1-rc1 changed the definition of vm_fault_t type to unsigned to catch
-vm_operations_struct::fault handlers which still have int as return value.
-LinuxDriverFault() in vmmon module is one of those.
-
-As handler return type was changed by commit 1c8f422059ae ("mm: change
-return type to vm_fault_t") in 4.17-rc1, make LinuxDriverFault() always
-return vm_fault_t and define vm_fault_t as int when building against
-a pre-4.17 kernel. (Except for the branch for really old kernels where
-the handler was vm_operations_struct::nopage and returned a pointer to
-struct page.)
----
- vmmon-only/linux/driver.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
-index cdc7fc1..fd9fdac 100644
---- a/vmmon-only/linux/driver.c
-+++ b/vmmon-only/linux/driver.c
-@@ -90,6 +90,9 @@ static Bool LinuxDriverCheckPadding(void);
- tv->tv_usec = now.tv_nsec / 1000;
- }
- #endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
-+typedef int vm_fault_t;
-+#endif
-
- /*
- *----------------------------------------------------------------------
-@@ -115,9 +118,9 @@ long LinuxDriver_Ioctl(struct file *filp, u_int iocmd,
- static int LinuxDriver_Close(struct inode *inode, struct file *filp);
- static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
--static int LinuxDriverFault(struct vm_fault *fault);
-+static vm_fault_t LinuxDriverFault(struct vm_fault *fault);
- #elif defined(VMW_NOPAGE_2624)
--static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
-+static vm_fault_t LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
- #else
- static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
- unsigned long address,
-@@ -902,11 +905,11 @@ LinuxDriverPollTimeout(compat_timer_arg_t unused) // IN:
- */
-
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
--static int
-+static vm_fault_t
- LinuxDriverFault(struct vm_fault *fault) //IN/OUT
- #elif defined(VMW_NOPAGE_2624)
--static int LinuxDriverFault(struct vm_area_struct *vma, //IN
-- struct vm_fault *fault) //IN/OUT
-+static vm_fault_t LinuxDriverFault(struct vm_area_struct *vma, //IN
-+ struct vm_fault *fault) //IN/OUT
- #else
- static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN
- unsigned long address, //IN
-From d20641f619bd3766cf5b50b2c750700eab189bd9 Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Tue, 9 Jul 2019 21:07:04 +0200
-Subject: [PATCH] vmmon: fix HostIF_SetFastClockRate() not to use force_sig()
-
-Commit 3cf5d076fb4d ("signal: Remove task parameter from force_sig") in
-v5.3-rc1 drops second argument of force_sig(); before that, all callers
-which passed something else than current task as second argument were
-fixed, mostly to use send_sig() instead.
-
-The situation in HostIF_SetFastClockRate() is the same as e.g. in bpfilter
-call fixed by commit 1dfd1711de29 ("signal/bpfilter: Fix bpfilter_kernl to
-use send_sig not force_sig"): locking in force_sig_info() cannot handle
-task exiting and using force_sig() for SIGKILL is pointless anyway as this
-signal cannot be blocked.
-
-As send_sig() is present with unchanged signature since the pre-git era, we
-can use send_sig() unconditionally, regardless of kernel version.
----
- vmmon-only/linux/hostif.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
-index 210f281..4da863b 100644
---- a/vmmon-only/linux/hostif.c
-+++ b/vmmon-only/linux/hostif.c
-@@ -3577,7 +3577,7 @@ HostIF_SetFastClockRate(unsigned int rate) // IN: Frequency in Hz.
+@@ -3524,7 +3577,6 @@ HostIF_SetFastClockRate(unsigned int rate) // IN: Frequency in Hz.
}
} else {
if (linuxState.fastClockThread) {
- force_sig(SIGKILL, linuxState.fastClockThread);
-+ send_sig(SIGKILL, linuxState.fastClockThread, 1);
kthread_stop(linuxState.fastClockThread);
close_rtc(linuxState.fastClockFile, current->files);
+@@ -3572,7 +3625,12 @@
+
+ ASSERT(handle);
+
+- if (!access_ok(VERIFY_WRITE, p, size)) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
++ if (!access_ok(VERIFY_WRITE, p, size))
++#else
++ if (!access_ok(p, size))
++#endif
++ {
+ printk(KERN_ERR "%s: Couldn't verify write to uva 0x%p with size %"
+ FMTSZ"u\n", __func__, p, size);
+