summarylogtreecommitdiffstats
path: root/vmnet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vmnet.patch')
-rw-r--r--vmnet.patch98
1 files changed, 55 insertions, 43 deletions
diff --git a/vmnet.patch b/vmnet.patch
index 226ba9f3149..f73136ea38b 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,6 +12,61 @@ index 459846e..cd29652 100644
# Header directory for the running kernel
ifdef LINUXINCLUDE
+--- a/vmnet/userif.c
++++ b/vmnet/userif.c
+@@ -137,16 +137,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) {
+@@ -158,7 +163,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
+ {
+@@ -201,7 +206,7 @@
+ return -EBUSY;
+ }
+
+- if ((retval = VNetUserIfMapUint32Ptr((VA)vn->pollPtr, &pollPage,
++ if ((retval = VNetUserIfMapUint32Ptr(vn->pollPtr, &pollPage,
+ &pollPtr)) < 0) {
+ return retval;
+ }
+@@ -213,7 +218,7 @@
+ goto error_free;
+ }
+
+- if ((retval = VNetUserIfMapUint32Ptr((VA)vn->recvClusterPtr,
++ if ((retval = VNetUserIfMapUint32Ptr(vn->recvClusterPtr,
+ &recvClusterPage,
+ &recvClusterCount)) < 0) {
+ goto error_free;
From 8ba37a5023f939ba8d2e0d91b916ff442b1c18dd Mon Sep 17 00:00:00 2001
From: Michal Kubecek <mkubecek@suse.cz>
Date: Mon, 31 Dec 2018 00:05:42 +0100
@@ -41,44 +94,3 @@ index caab6b9..c2fc51f 100644
MODULEBUILDDIR=$(MODULEBUILDDIR) modules
$(MAKE) -C $$PWD SRCROOT=$$PWD/$(SRCROOT) \
MODULEBUILDDIR=$(MODULEBUILDDIR) postbuild
-From 92b90ac11baf215ba73cb94e5aebf0576f1966a0 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 acc6ca6..5d935ee 100644
---- a/vmnet-only/userif.c
-+++ b/vmnet-only/userif.c
-@@ -85,6 +85,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
-+
- /*
- *-----------------------------------------------------------------------------
- *
-@@ -142,7 +148,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;