]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/lsm_hooks.h
UBUNTU: SAUCE: LSM stacking: allow selecting multiple LSMs using kernel boot params
[mirror_ubuntu-bionic-kernel.git] / include / linux / lsm_hooks.h
index 7161d8e7ee79246ffca220805826f883f26d7ddd..5905d88e9d28fa1e3414a01c294ba72cf8c67253 100644 (file)
@@ -1968,6 +1968,34 @@ struct security_hook_list {
        char                            *lsm;
 } __randomize_layout;
 
+/*
+ * The maximum number of major security modules.
+ * Used to avoid excessive memory management while
+ * mapping global and module specific secids.
+ *
+ * Currently SELinux, Smack, AppArmor, TOMOYO
+ * Oh, but Casey needs to come up with the right way
+ * to identify a "major" module, so use the total number
+ * of modules (including minor) for now.
+ * Minor: Capability, Yama, LoadPin
+ */
+#define        LSM_MAX_MAJOR   8
+
+/*
+ * Security blob size or offset data.
+ */
+struct lsm_blob_sizes {
+       int     lbs_cred;
+       int     lbs_file;
+       int     lbs_inode;
+       int     lbs_ipc;
+       int     lbs_key;
+       int     lbs_msg_msg;
+       int     lbs_sock;
+       int     lbs_superblock;
+       int     lbs_task;
+};
+
 /*
  * Initializing a security_hook_list structure takes
  * up a lot of space in a source file. This macro takes
@@ -1980,6 +2008,7 @@ struct security_hook_list {
 extern struct security_hook_heads security_hook_heads;
 extern char *lsm_names;
 
+extern void security_add_blobs(struct lsm_blob_sizes *needed);
 extern void security_add_hooks(struct security_hook_list *hooks, int count,
                                char *lsm);
 
@@ -2013,7 +2042,7 @@ static inline void security_delete_hooks(struct security_hook_list *hooks,
 #define __lsm_ro_after_init    __ro_after_init
 #endif /* CONFIG_SECURITY_WRITABLE_HOOKS */
 
-extern int __init security_module_enable(const char *module);
+extern bool __init security_module_enable(const char *lsm, const bool stacked);
 extern void __init capability_add_hooks(void);
 #ifdef CONFIG_SECURITY_YAMA
 extern void __init yama_add_hooks(void);
@@ -2026,4 +2055,12 @@ void __init loadpin_add_hooks(void);
 static inline void loadpin_add_hooks(void) { };
 #endif
 
+extern int lsm_cred_alloc(struct cred *cred, gfp_t gfp);
+extern int lsm_inode_alloc(struct inode *inode);
+
+#ifdef CONFIG_SECURITY
+void lsm_early_cred(struct cred *cred);
+void lsm_early_inode(struct inode *inode);
+#endif
+
 #endif /* ! __LINUX_LSM_HOOKS_H */