Skip to content

Instantly share code, notes, and snippets.

@ntfargo
Created July 14, 2026 05:15
Show Gist options
  • Select an option

  • Save ntfargo/050b9481902169f06b41fe2b0131388d to your computer and use it in GitHub Desktop.

Select an option

Save ntfargo/050b9481902169f06b41fe2b0131388d to your computer and use it in GitHub Desktop.
diff --git a/vmmon-only/Makefile.kernel b/vmmon-only/Makefile.kernel
index a39e099..074983d 100644
--- a/vmmon-only/Makefile.kernel
+++ b/vmmon-only/Makefile.kernel
@@ -21,6 +21,7 @@ CC_OPTS += -DVMMON -DVMCORE
INCLUDE := -I$(SRCROOT)/include -I$(SRCROOT)/include/x86 -I$(SRCROOT)/common -I$(SRCROOT)/linux
EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
+ccflags-y += $(CC_OPTS) $(INCLUDE)
obj-m += $(DRIVER).o
diff --git a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
index ab8e2dc..67d6843 100644
--- a/vmmon-only/linux/driver.c
+++ b/vmmon-only/linux/driver.c
@@ -28,6 +28,7 @@
#include <linux/preempt.h>
#include <linux/slab.h>
#include <linux/smp.h>
+#include <linux/timer.h>
#include <linux/wait.h>
#include <asm/hw_irq.h> /* for CALL_FUNCTION_VECTOR */
@@ -345,7 +346,7 @@ LinuxDriverExit(void)
Log("Module %s: unloaded\n", vmmon_miscdev.name);
- del_timer_sync(&tscTimer);
+ timer_delete_sync(&tscTimer);
Vmx86_CleanupHVIOBitmap();
Task_Terminate();
diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
index c1e6c67..683114a 100644
--- a/vmmon-only/linux/hostif.c
+++ b/vmmon-only/linux/hostif.c
@@ -54,6 +54,7 @@
#include <linux/hrtimer.h>
#include <linux/signal.h>
#include <linux/taskstats_kern.h> // For linux/sched/signal.h without version check
+#include <linux/timer.h>
#include "x86apic.h"
#include "modulecall.h"
@@ -1995,7 +1996,7 @@ HostIF_InitUptime(void)
void
HostIF_CleanupUptime(void)
{
- del_timer_sync(&uptimeState.timer);
+ timer_delete_sync(&uptimeState.timer);
}
@@ -3410,9 +3411,8 @@ HostIF_SafeRDMSR(unsigned int msr, // IN
int err;
u64 v;
- err = rdmsrl_safe(msr, &v);
+ err = rdmsrq_safe(msr, &v);
*val = (err == 0) ? v : 0; // Linux corrupts 'v' on error
return err;
}
-
diff --git a/vmnet-only/vmnetInt.h b/vmnet-only/vmnetInt.h
index b49c399..18157cb 100644
--- a/vmnet-only/vmnetInt.h
+++ b/vmnet-only/vmnetInt.h
@@ -41,8 +41,13 @@
compat_skb_set_network_header(skb, sizeof (struct ethhdr)), \
dev_queue_xmit(skb) \
)
-#define dev_lock_list() read_lock(&dev_base_lock)
-#define dev_unlock_list() read_unlock(&dev_base_lock)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+# define dev_lock_list() rcu_read_lock()
+# define dev_unlock_list() rcu_read_unlock()
+#else
+# define dev_lock_list() read_lock(&dev_base_lock)
+# define dev_unlock_list() read_unlock(&dev_base_lock)
+#endif
extern struct proto vmnet_proto;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment