Created
October 27, 2016 08:48
-
-
Save aronsky/05de2cb06859c2c5c7e69c27db7354b9 to your computer and use it in GitHub Desktop.
Revisions
-
aronsky created this gist
Oct 27, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/version.h> #include <linux/kallsyms.h> #include <../fs/mount.h> #include <linux/namei.h> #include <linux/blkdev.h> #define DRIVER_AUTHOR "mr47" #define DRIVER_DESCRIPTION "KnoxOut" #define DRIVER_VERSION "1.0" static int __init wp_mod_init(void) { struct path path; struct super_block *sb; pr_info("wp_mod: %s version %s\n", DRIVER_DESCRIPTION, DRIVER_VERSION); pr_info("wp_mod: by %s\n", DRIVER_AUTHOR); if (kern_path("/system", LOOKUP_FOLLOW, &path)) { pr_info("wp_mod: kern_path failed!\n"); } sb = path.mnt->mnt_sb; pr_info("wp_mod: block device superblock policy: 0x%08x\n", sb->s_bdev->bd_part->policy); sb->s_bdev->bd_part->policy = 0; return 0; } static void __exit wp_mod_exit(void) { return; } module_init(wp_mod_init); module_exit(wp_mod_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESCRIPTION); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL");