summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Marc Lenoir2023-03-19 14:24:59 +0100
committerJean-Marc Lenoir2023-03-19 14:24:59 +0100
commita3cec4e4b258ec334f330cbae173e676c40c616e (patch)
tree586fb0c889727296835707f153e0410681032c8b
parenteb329dd2b333c893551601d8b910d89a2f5b4df6 (diff)
downloadaur-a3cec4e4b258ec334f330cbae173e676c40c616e.tar.gz
Fix a potential crash when loading vmnet module
Fix compilation with Linux 6.3-rc2
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rw-r--r--vmmon.patch12
-rw-r--r--vmnet.patch138
4 files changed, 156 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5095d7eecd71..fba590186064 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = vmware-workstation11
pkgdesc = The industry standard for running multiple operating systems as virtual machines on a single Linux PC.
pkgver = 11.1.4
- pkgrel = 25
+ pkgrel = 26
url = https://www.vmware.com/products/workstation-for-linux.html
install = vmware-workstation.install
arch = x86_64
@@ -84,7 +84,7 @@ pkgbase = vmware-workstation11
sha256sums = fe1b1be8297f4170406f97dd1f8b385d911faf45afe19cbc0c26b8092b3ddf8d
sha256sums = 10562d11d50edab9abc2b29c8948714edcb9b084f99b3766d07ddd21259e372e
sha256sums = 273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac
- sha256sums = 1e9f151b97b19661f4d4fb4276bc252087047bf557f87ceacb374811d612b436
- sha256sums = 7304f6e134a7c98a78b168048b3657e7c82d10400b697bec0aab143e574a8b06
+ sha256sums = 9dcbc2ad7c1da946b3d10fe93e5502b1e9cf441c7c10c73f3e7b9341baf2a87d
+ sha256sums = d778be617a29d465de845616138877d422d1b1f85391355eb94bc16d62344f11
pkgname = vmware-workstation11
diff --git a/PKGBUILD b/PKGBUILD
index 847cc7dadccc..047ee349c27c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,7 +16,7 @@ pkgname=vmware-workstation11
pkgver=11.1.4
_buildver=3848939
_pkgver=${pkgver}_${_buildver}
-pkgrel=25
+pkgrel=26
pkgdesc='The industry standard for running multiple operating systems as virtual machines on a single Linux PC.'
arch=(x86_64)
url='https://www.vmware.com/products/workstation-for-linux.html'
@@ -121,8 +121,8 @@ sha256sums=(
'10562d11d50edab9abc2b29c8948714edcb9b084f99b3766d07ddd21259e372e'
'273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac'
- '1e9f151b97b19661f4d4fb4276bc252087047bf557f87ceacb374811d612b436'
- '7304f6e134a7c98a78b168048b3657e7c82d10400b697bec0aab143e574a8b06'
+ '9dcbc2ad7c1da946b3d10fe93e5502b1e9cf441c7c10c73f3e7b9341baf2a87d'
+ 'd778be617a29d465de845616138877d422d1b1f85391355eb94bc16d62344f11'
)
options=(!strip emptydirs)
diff --git a/vmmon.patch b/vmmon.patch
index 08806a4eec67..210cc9d56149 100644
--- a/vmmon.patch
+++ b/vmmon.patch
@@ -1073,6 +1073,18 @@
VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
unsigned long pg;
struct page* page;
+@@ -1106,7 +1071,11 @@ LinuxDriverMmap(struct file *filp,
+ return err;
+ }
+ /* Clear VM_IO, otherwise SuSE's kernels refuse to do get_user_pages */
++#if COMPAT_LINUX_VERSION_CHECK_LT(6, 3, 0)
+ vma->vm_flags &= ~VM_IO;
++#else
++ vm_flags_clear(vma, VM_IO);
++#endif
+
+ return 0;
+ }
@@ -1398,7 +1363,6 @@ LinuxDriver_Ioctl(struct inode *inode,
case IOCTL_VMX86_CREATE_VM:
case IOCTL_VMX86_INIT_CROSSGDT:
diff --git a/vmnet.patch b/vmnet.patch
index 3687d29c7079..0ac7bbde08f6 100644
--- a/vmnet.patch
+++ b/vmnet.patch
@@ -505,3 +505,141 @@
}
e = e->nextEvent;
}
+From 650fb3abeb82f2b7d3a14f9579a7529d153636b7 Mon Sep 17 00:00:00 2001
+From: Michal Kubecek <mkubecek@suse.cz>
+Date: Fri, 7 Oct 2022 12:56:44 +0200
+Subject: [PATCH] vmnet: work around field-spanning write warning (#195)
+
+While VMware 17.0.1 did work around the field-spanning write warning in
+VNetEvent_Send() by wrapping struct VNet_EventHeader into a union, they
+neglected to handle the same problem in VNetUserListenerEventHandler() so
+that running 17.0.1 on kernel >= 6.1-rc1 still issues
+
+ memcpy: detected field-spanning write (size 28) of single field "&t->event"
+
+only this time it happens on VM start rather than on module load. Apply the
+same workaround as in 17.0.0 branch to avoid the warning.
+---
+ vmnet-only/vnet.h | 8 ++++++++
+ vmnet-only/vnetEvent.c | 2 +-
+ vmnet-only/vnetUserListener.c | 2 +-
+ 3 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/vmnet-only/vnet.h b/vmnet-only/vnet.h
+index d6691d5c..d5bb5572 100644
+--- a/vmnet-only/vnet.h
++++ b/vmnet-only/vnet.h
+@@ -258,6 +258,7 @@ typedef struct VNet_EventHeader {
+ uint32 eventId;
+ uint32 classSet;
+ uint32 type;
++ char payload[];
+ } VNet_EventHeader;
+ #pragma pack(pop)
+
+@@ -275,6 +276,13 @@ typedef struct VNet_LinkStateEvent {
+ } VNet_LinkStateEvent;
+ #pragma pack(pop)
+
++static inline void VNet_Event_copy(VNet_EventHeader *dst,
++ const VNet_EventHeader *src)
++{
++ *dst = *src;
++ memcpy(dst->payload, src->payload, src->size - sizeof(*src));
++}
++
+ /*
+ *----------------------------------------------------------------------------
+ */
+diff --git a/vmnet-only/vnetEvent.c b/vmnet-only/vnetEvent.c
+index f1579292..12036070 100644
+--- a/vmnet-only/vnetEvent.c
++++ b/vmnet-only/vnetEvent.c
+@@ -401,7 +401,7 @@ VNetEvent_Send(VNetEvent_Sender *s, // IN: a sender
+ p->nextEvent = s->firstEvent;
+ s->firstEvent = p;
+ }
+- memcpy(&p->event, e, e->size);
++ VNet_Event_copy(&p->event.header, e);
+
+ /* send event */
+ classSet = e->classSet;
+diff --git a/vmnet-only/vnetUserListener.c b/vmnet-only/vnetUserListener.c
+index 114f3907..e9f51755 100644
+--- a/vmnet-only/vnetUserListener.c
++++ b/vmnet-only/vnetUserListener.c
+@@ -226,7 +226,7 @@ VNetUserListenerEventHandler(void *context, // IN: the user listener
+ return;
+ }
+ t->nextEvent = NULL;
+- memcpy(&t->event, e, e->size);
++ VNet_Event_copy(&t->event, e);
+
+ /* append event to event list */
+ userListener = (VNetUserListener*)context;
+From 0ca979d4bd06144204d720bb82f0a1e29024f9fa Mon Sep 17 00:00:00 2001
+From: Michal Kubecek <mkubecek@suse.cz>
+Date: Wed, 18 Jan 2023 00:19:52 +0100
+Subject: [PATCH] vmnet: use explicit module_init() and module_exit() (#187)
+
+While vmmon module already uses explicit module_init() and module_exit()
+for its init and cleanup function, vmnet relies on traditional magic names
+init_module() and cleanup_module(). Apparently this has an unfortunate side
+effect that the two functions are not identified as indirect call targets
+by objdump and they get "sealed" when the module is built against and
+loaded into an IBT enabled kernel.
+
+Starting with 6.3-rc1, objtool is going to warn about this issue,
+indicating that the legacy module initialization is deprecated and
+module_init() and module_exit() macros should be used instead so do that
+for vmnet as well.
+---
+ vmnet-only/driver.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c
+index 197a213..b22cbfb 100644
+--- a/vmnet-only/driver.c
++++ b/vmnet-only/driver.c
+@@ -279,7 +279,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list
+ /*
+ *----------------------------------------------------------------------
+ *
+- * init_module --
++ * vmnet_init_module --
+ *
+ * linux module entry point. Called by /sbin/insmod command.
+ * Initializes module and Registers this driver for a
+@@ -296,7 +296,7 @@ VNetRemovePortFromList(const VNetPort *port) // IN: port to remove from list
+ */
+
+ int
+-init_module(void)
++vmnet_init_module(void)
+ {
+ int retval;
+
+@@ -358,7 +358,7 @@ init_module(void)
+ /*
+ *----------------------------------------------------------------------
+ *
+- * cleanup_module --
++ * vmnet_cleanup_module --
+ *
+ * Called by /sbin/rmmod. Unregisters this driver for a
+ * vnet major #, and deinitializes the modules. The 64-bit
+@@ -375,7 +375,7 @@ init_module(void)
+ */
+
+ void
+-cleanup_module(void)
++vmnet_cleanup_module(void)
+ {
+ unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet");
+ VNetProtoUnregister();
+@@ -1705,3 +1705,5 @@ MODULE_LICENSE("GPL v2");
+ * by default (i.e., neither mkinitrd nor modprobe will accept it).
+ */
+ MODULE_INFO(supported, "external");
++module_init(vmnet_init_module);
++module_exit(vmnet_cleanup_module);