summarylogtreecommitdiffstats
path: root/vmnet.patch
diff options
context:
space:
mode:
authorJean-Marc Lenoir2019-07-27 13:06:24 +0200
committerJean-Marc Lenoir2019-07-27 13:06:24 +0200
commita425dd009dd8d22a4c541610bea347a549358a2a (patch)
treeb45ceead489cafde815d4e5fe206acf230d9c95d /vmnet.patch
parente1c74ee0aeae4e484d297362f9961f16213fc247 (diff)
downloadaur-a425dd009dd8d22a4c541610bea347a549358a2a.tar.gz
Compatibility with Linux 5.3-rc1
Diffstat (limited to 'vmnet.patch')
-rw-r--r--vmnet.patch150
1 files changed, 53 insertions, 97 deletions
diff --git a/vmnet.patch b/vmnet.patch
index 8e99551a5ef2..a6e65d7cfc45 100644
--- a/vmnet.patch
+++ b/vmnet.patch
@@ -1,5 +1,3 @@
-diff --git a/vmnet/Makefile b/vmnet/Makefile
-index 459846e..cd29652 100644
--- a/vmnet/Makefile
+++ b/vmnet/Makefile
@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
@@ -14,7 +12,6 @@ index 459846e..cd29652 100644
# Header directory for the running kernel
ifdef LINUXINCLUDE
-diff --git a/vmnet/bridge.c b/vmnet/bridge.c
--- a/vmnet/bridge.c
+++ b/vmnet/bridge.c
@@ -636,7 +636,7 @@
@@ -45,7 +42,6 @@ diff --git a/vmnet/bridge.c b/vmnet/bridge.c
switch (msg) {
case NETDEV_UNREGISTER:
LOG(2, (KERN_DEBUG "bridge-%s: interface %s is unregistering\n",
-diff --git a/vmnet/compat_netdevice.h b/vmnet/compat_netdevice.h
--- a/vmnet/compat_netdevice.h
+++ b/vmnet/compat_netdevice.h
@@ -337,4 +337,11 @@
@@ -60,7 +56,6 @@ diff --git a/vmnet/compat_netdevice.h b/vmnet/compat_netdevice.h
+#endif
+
#endif /* __COMPAT_NETDEVICE_H__ */
-diff --git a/vmnet/netif.c b/vmnet/netif.c
--- a/vmnet/netif.c
+++ b/vmnet/netif.c
@@ -149,7 +149,7 @@
@@ -81,8 +76,6 @@ diff --git a/vmnet/netif.c b/vmnet/netif.c
return 0;
}
-diff --git a/vmnet/userif.c b/vmnet/userif.c
-index 94146f6..5298406 100644
--- a/vmnet/userif.c
+++ b/vmnet/userif.c
@@ -36,6 +36,9 @@
@@ -107,8 +100,59 @@ index 94146f6..5298406 100644
if (retval != 1) {
return NULL;
-diff --git a/vmnet/vmnetInt.h b/vmnet/vmnetInt.h
-index 0ee52ec..4e3b923 100644
+@@ -143,16 +143,21 @@
+ */
+
+ static INLINE int
+-VNetUserIfMapPtr(VA uAddr, // IN: pointer to user memory
++VNetUserIfMapPtr(VA64 uAddr, // IN: pointer to user memory
+ size_t size, // IN: size of data
+ struct page **p, // OUT: locked page
+ void **ptr) // OUT: kernel mapped pointer
+ {
+- if (!access_ok(VERIFY_WRITE, (void *)uAddr, size) ||
+- (((uAddr + size - 1) & ~(PAGE_SIZE - 1)) !=
+- (uAddr & ~(PAGE_SIZE - 1)))) {
++ uint8 v;
++
++ /* Check area does not straddle two pages. */
++ if ((uAddr & (PAGE_SIZE - 1)) + size > PAGE_SIZE) {
+ return -EINVAL;
+ }
++ /* Check if it is user's area. UserifLockPage() checks writability. */
++ if (copy_from_user(&v, (void *)(unsigned long)uAddr, sizeof v) != 0) {
++ return -EFAULT;
++ }
+
+ *p = UserifLockPage(uAddr);
+ if (*p == NULL) {
+@@ -164,7 +169,7 @@
+ }
+
+ static INLINE int
+-VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory
++VNetUserIfMapUint32Ptr(VA64 uAddr, // IN: pointer to user memory
+ struct page **p, // OUT: locked page
+ uint32 **ptr) // OUT: kernel mapped pointer
+ {
+@@ -209,7 +214,7 @@
+ return -EBUSY;
+ }
+
+- if ((retval = VNetUserIfMapUint32Ptr((VA)vn->pollPtr, &pollPage,
++ if ((retval = VNetUserIfMapUint32Ptr(vn->pollPtr, &pollPage,
+ &pollPtr)) < 0) {
+ return retval;
+ }
+@@ -227,7 +232,7 @@
+ goto error_free;
+ }
+
+- if ((retval = VNetUserIfMapUint32Ptr((VA)vn->recvClusterPtr,
++ if ((retval = VNetUserIfMapUint32Ptr(vn->recvClusterPtr,
+ &recvClusterPage,
+ &recvClusterCount)) < 0) {
+ goto error_free;
--- a/vmnet/vmnetInt.h
+++ b/vmnet/vmnetInt.h
@@ -77,7 +77,7 @@
@@ -147,91 +191,3 @@ index caab6b9..c2fc51f 100644
MODULEBUILDDIR=$(MODULEBUILDDIR) modules
$(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
-From c3fb5cda191137afddfdbd2f31bb4b15f9aeb3f2 Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Mon, 31 Dec 2018 00:15:11 +0100
-Subject: [PATCH] vmmon: bring back the do_gettimeofday() helper
-
-The do_gettimeofday() helper was removed by commit e4b92b108c6c
-("timekeeping: remove obsolete time accessors") in v5.0-rc1. Bring it back
-for users in vmmon-only/linux/hostif.c.
-
-This feels like a quick and clumsy band aid to allow build with post-4.20
-kernels. On a closer look, the whole gymnastics around uptimeState and
-HostIFReadUptimeWork() with jiffies and wall time checking and correcting
-each other seems to be a workaround for an absence of high resolution
-monotonic time. Considering ktime_get_ts64() is available since 3.17 and
-before that, ktime_get_ts() since 2.6.17, perhaps the time has come to
-clean all this machinery up. But something like this would be beyond the
-scope of this repository.
----
- vmmon-only/include/compat_timekeeping32.h | 15 +++++++++++++++
- vmmon-only/linux/driver.c | 1 +
- vmmon-only/linux/hostif.c | 1 +
- vmnet-only/bridge.c | 11 +++++++++++
- 4 files changed, 28 insertions(+)
- create mode 100644 vmmon-only/include/compat_timekeeping32.h
-
-diff --git a/vmnet-only/bridge.c b/vmnet-only/bridge.c
-index c569054..6e3249a 100644
---- a/vmnet-only/bridge.c
-+++ b/vmnet-only/bridge.c
-@@ -52,6 +52,17 @@
- #include "vnetInt.h"
- #include "smac.h"
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
-+static inline void do_gettimeofday(struct timeval *tv)
-+{
-+ struct timespec64 now;
-+
-+ ktime_get_real_ts64(&now);
-+ tv->tv_sec = now.tv_sec;
-+ tv->tv_usec = now.tv_nsec / 1000;
-+}
-+#endif
-+
- #define VNET_BRIDGE_HISTORY 48
-
- /*
-From 5db3c8a86f435e21f37a2acf386e2e52a1b42aa6 Mon Sep 17 00:00:00 2001
-From: Michal Kubecek <mkubecek@suse.cz>
-Date: Sat, 5 Jan 2019 01:54:57 +0100
-Subject: [PATCH] modules: handle access_ok() with two arguments
-
-Since commit 96d4f267e40f ("Remove 'type' argument from access_ok()
-function") in v5.0-rc1, the type argument of access_ok() was dropped.
-The same commit also dropped macros VERIFY_READ and VERIFY_WRITE so check
-for their existence on pre-5.0 kernels to allow build against kernels with
-this change backported.
----
- vmmon-only/linux/hostif.c | 8 +++++++-
- vmnet-only/userif.c | 8 +++++++-
- 2 files changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
-index a7aee04..eecd4f8 100644
---- a/vmnet-only/userif.c
-+++ b/vmnet-only/userif.c
-@@ -91,6 +91,12 @@ extern unsigned int vnet_max_qlen;
- # define compat_kunmap(page) kunmap((page).p)
- #endif
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && defined(VERIFY_WRITE)
-+ #define write_access_ok(addr, size) access_ok(VERIFY_WRITE, addr, size)
-+#else
-+ #define write_access_ok(addr, size) access_ok(addr, size)
-+#endif
-+
- /*
- *-----------------------------------------------------------------------------
- *
-@@ -148,7 +154,7 @@ VNetUserIfMapPtr(VA uAddr, // IN: pointer to user memory
- struct page **p, // OUT: locked page
- void **ptr) // OUT: kernel mapped pointer
- {
-- if (!access_ok(VERIFY_WRITE, (void *)uAddr, size) ||
-+ if (!write_access_ok((void *)uAddr, size) ||
- (((uAddr + size - 1) & ~(PAGE_SIZE - 1)) !=
- (uAddr & ~(PAGE_SIZE - 1)))) {
- return -EINVAL;