Less converstaion

This commit is contained in:
Ciro Santilli
2017-11-13 14:25:24 +00:00
parent 9ec43c4e88
commit fa0a7e150d
10 changed files with 116 additions and 250 deletions

View File

@@ -0,0 +1,30 @@
/*
insmod /vermagic_fail.ko
# => insmod: can't insert '/vermagic_fail.ko': invalid module format
modinfo /vermagic_fail.ko | grep vermagic
# => vermagic: asdfqwer
# => vermagic: 4.9.6 SMP mod_unload modversions
kmod `modprobe` has a flag to skip the check:
--force-modversion
Looks like it just strips `modversion` information from the module before loading, and then the kernel skips the check.
*/
#include <linux/module.h>
#include <linux/kernel.h>
static int myinit(void)
{
pr_info("vermagic_fail\n");
return 0;
}
static void myexit(void) {}
module_init(myinit)
module_exit(myexit)
MODULE_INFO(vermagic, "asdfqwer");
MODULE_LICENSE("GPL");