summarylogtreecommitdiffstats
path: root/vmnet.patch
blob: 226ba9f314920658004a843d8788520ad7d7ca5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
 endif
 
 
+ifdef KVERSION
+VM_UNAME = $(KVERSION)
+else
 VM_UNAME = $(shell uname -r)
+endif
 
 # Header directory for the running kernel
 ifdef LINUXINCLUDE
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/vmnet-only/Makefile b/vmnet-only/Makefile
index caab6b9..c2fc51f 100644
--- a/vmnet-only/Makefile
+++ b/vmnet-only/Makefile
@@ -111,7 +111,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 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;