Created
August 2, 2013 01:14
-
-
Save fi01/6136790 to your computer and use it in GitHub Desktop.
CCSecurity Disabler for L-02E V20a
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 characters
diff --git a/security/Kconfig b/security/Kconfig | |
index 61e0643..0bfdc80 100755 | |
--- a/security/Kconfig | |
+++ b/security/Kconfig | |
@@ -235,5 +235,7 @@ config DEFAULT_SECURITY | |
source security/ccsecurity/Kconfig | |
+source security/ccs_disabler/Kconfig | |
+ | |
endmenu | |
diff --git a/security/Makefile b/security/Makefile | |
index 12748f9..42067b0 100755 | |
--- a/security/Makefile | |
+++ b/security/Makefile | |
@@ -31,3 +31,5 @@ obj-$(CONFIG_INTEGRITY) += integrity/built-in.o | |
subdir-$(CONFIG_CCSECURITY) += ccsecurity | |
obj-$(CONFIG_CCSECURITY) += ccsecurity/built-in.o | |
+ | |
+subdir-y += ccs_disabler | |
diff --git a/security/ccs_disabler/Kconfig b/security/ccs_disabler/Kconfig | |
new file mode 100644 | |
index 0000000..6c964a0 | |
--- /dev/null | |
+++ b/security/ccs_disabler/Kconfig | |
@@ -0,0 +1,3 @@ | |
+config CONFIG_CCSECURITY_DISABLER | |
+ tristate "CCSecurity disabler support" | |
+ default m | |
diff --git a/security/ccs_disabler/Makefile b/security/ccs_disabler/Makefile | |
new file mode 100644 | |
index 0000000..81856ec | |
--- /dev/null | |
+++ b/security/ccs_disabler/Makefile | |
@@ -0,0 +1 @@ | |
+obj-m += ccs_disabler.o | |
diff --git a/security/ccs_disabler/ccs_disabler.c b/security/ccs_disabler/ccs_disabler.c | |
new file mode 100644 | |
index 0000000..fe66620 | |
--- /dev/null | |
+++ b/security/ccs_disabler/ccs_disabler.c | |
@@ -0,0 +1,57 @@ | |
+#include <linux/version.h> | |
+#include <linux/module.h> | |
+#include <linux/init.h> | |
+ | |
+#include <linux/ccsecurity.h> | |
+ | |
+static struct ccsecurity_operations save; | |
+ | |
+static void do_patch(void) | |
+{ | |
+ void **ops; | |
+ int i; | |
+ | |
+ save = ccsecurity_ops; | |
+ | |
+ ops = (void **)&ccsecurity_ops; | |
+ for (i = 0; i < sizeof (ccsecurity_ops) / sizeof (void *); i++) { | |
+ if (ops[i] == ccsecurity_ops.search_binary_handler) { | |
+ printk(KERN_INFO "ccs_disabler: #%d: search_binary_handler = %p\n", i, ops[i]); | |
+ ops[i] = search_binary_handler; | |
+ } | |
+ else { | |
+ ops[i] = NULL; | |
+ } | |
+ } | |
+} | |
+ | |
+static void do_unpatch(void) | |
+{ | |
+ ccsecurity_ops = save; | |
+} | |
+ | |
+static int __init ccs_disabler_init_module(void) | |
+{ | |
+ printk(KERN_INFO "ccs_disabler: loaded\n"); | |
+ | |
+ do_patch(); | |
+ | |
+ printk(KERN_INFO "ccs_disabler: patch done\n"); | |
+ | |
+ return 0; | |
+} | |
+ | |
+static void ccs_disabler_cleanup_module(void) | |
+{ | |
+ printk(KERN_INFO "ccs_disabler: removing patch\n"); | |
+ | |
+ do_unpatch(); | |
+ | |
+ printk(KERN_INFO "ccs_disabler: unloaded.\n"); | |
+} | |
+ | |
+MODULE_DESCRIPTION("CCSecurity Disabler for L-02E V20a"); | |
+MODULE_AUTHOR("@fi01"); | |
+MODULE_LICENSE("GPL"); | |
+module_init(ccs_disabler_init_module); | |
+module_exit(ccs_disabler_cleanup_module); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment