[PATCH] kmod in usermode (module loader in Ring 3)

From: Christopher Sacchi
Date: Sat Apr 25 2015 - 18:01:48 EST


This is an experimental patch to put kmod in Ring 3, rather than Ring 0.
Here it is, below the dashed lines:

---------------------------------------------------------------------------------------------------------------------------

Signed-off-by: Christopher P. Sacchi <christophersacchi@xxxxxxxxx>

--- kmod.old 2015-04-12 18:12:50.000000000 -0400
+++ kmod.c 2015-04-25 17:52:47.629844677 -0400
@@ -43,6 +43,14 @@

#include <trace/events/module.h>

+#ifdef CONFIG_X64
+asm("sysret");
+#endif
+
+#ifndef CONFIG_X64
+asm("sysexit");
+#endif
+
extern int max_threads;

static struct workqueue_struct *khelper_wq;
@@ -692,3 +700,11 @@ void __init usermodehelper_init(void)
khelper_wq = create_singlethread_workqueue("khelper");
BUG_ON(!khelper_wq);
}
+
+#ifdef CONFIG_X64
+asm("syscall");
+#endif
+
+#ifndef CONFIG_X64
+asm("sysenter");
+#endif

---------------------------------------------------------------------------------------------------------------------------

Regards,
Christopher P. Sacchi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/