• R/O
  • SSH
  • HTTPS

caitsith: Commit


Commit MetaInfo

Revision235 (tree)
Time2017-04-08 23:12:49
Authorkumaneko

Log Message

Remove caitsith_exports.add_hooks

Change Summary

Incremental Difference

--- trunk/caitsith-patch/include/linux/caitsith.h (revision 234)
+++ trunk/caitsith-patch/include/linux/caitsith.h (revision 235)
@@ -54,9 +54,6 @@
5454 /* For exporting variables and functions. */
5555 struct caitsith_exports {
5656 void (*load_policy)(const char *filename);
57-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && defined(CONFIG_SECURITY)
58- void (*add_hooks)(void);
59-#endif
6057 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
6158 char * (*d_absolute_path)(const struct path *, char *, int);
6259 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
--- trunk/caitsith-patch/security/caitsith/load_policy.c (revision 234)
+++ trunk/caitsith-patch/security/caitsith/load_policy.c (revision 235)
@@ -234,9 +234,6 @@
234234 #ifndef CONFIG_CAITSITH_OMIT_USERSPACE_LOADER
235235 .load_policy = cs_load_policy,
236236 #endif
237-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && defined(CONFIG_SECURITY)
238- .add_hooks = cs_add_hooks,
239-#endif
240237 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
241238 .d_absolute_path = d_absolute_path,
242239 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
--- trunk/caitsith-patch/security/caitsith/lsm2caitsith.c (revision 234)
+++ trunk/caitsith-patch/security/caitsith/lsm2caitsith.c (revision 235)
@@ -266,18 +266,17 @@
266266 #endif
267267 };
268268
269-static void cs_add_hooks(void)
269+static int __init cs_add_hooks(void)
270270 {
271+ if (caitsith_ops.disabled)
272+ return 0;
271273 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
272- int i;
273-
274- for (i = 0; i < ARRAY_SIZE(caitsith_hooks); i++) {
275- caitsith_hooks[i].lsm = "caitsith";
276- list_add_tail_rcu(&caitsith_hooks[i].list,
277- caitsith_hooks[i].head);
278- }
274+ security_add_hooks(caitsith_hooks, ARRAY_SIZE(caitsith_hooks),
275+ "caitsith");
279276 #else
280277 security_add_hooks(caitsith_hooks, ARRAY_SIZE(caitsith_hooks));
281278 #endif
279+ return 0;
282280 }
281+late_initcall(cs_add_hooks);
283282 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && defined(CONFIG_SECURITY) */
--- trunk/caitsith-patch/security/caitsith/policy_io.c (revision 234)
+++ trunk/caitsith-patch/security/caitsith/policy_io.c (revision 235)
@@ -2245,9 +2245,6 @@
22452245 cs_policy_loaded = true;
22462246 printk(KERN_INFO "CaitSith: 0.2.1 2017/02/20\n");
22472247 if (cs_policy_version == 20120401) {
2248-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && defined(CONFIG_SECURITY)
2249- caitsith_exports.add_hooks();
2250-#endif
22512248 printk(KERN_INFO "CaitSith module activated.\n");
22522249 return;
22532250 }
Show on old repository browser