Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Landlock LSM - Security framework setup
0004  *
0005  * Copyright © 2016-2020 Mickaël Salaün <mic@digikod.net>
0006  * Copyright © 2018-2020 ANSSI
0007  */
0008 
0009 #include <linux/init.h>
0010 #include <linux/lsm_hooks.h>
0011 
0012 #include "common.h"
0013 #include "cred.h"
0014 #include "fs.h"
0015 #include "ptrace.h"
0016 #include "setup.h"
0017 
0018 bool landlock_initialized __lsm_ro_after_init = false;
0019 
0020 struct lsm_blob_sizes landlock_blob_sizes __lsm_ro_after_init = {
0021     .lbs_cred = sizeof(struct landlock_cred_security),
0022     .lbs_inode = sizeof(struct landlock_inode_security),
0023     .lbs_superblock = sizeof(struct landlock_superblock_security),
0024 };
0025 
0026 static int __init landlock_init(void)
0027 {
0028     landlock_add_cred_hooks();
0029     landlock_add_ptrace_hooks();
0030     landlock_add_fs_hooks();
0031     landlock_initialized = true;
0032     pr_info("Up and running.\n");
0033     return 0;
0034 }
0035 
0036 DEFINE_LSM(LANDLOCK_NAME) = {
0037     .name = LANDLOCK_NAME,
0038     .init = landlock_init,
0039     .blobs = &landlock_blob_sizes,
0040 };