diff options
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r-- | security/smack/smack_lsm.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index de396742abf4..8ad48161cef5 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1012,6 +1012,41 @@ static void smack_cred_commit(struct cred *new, const struct cred *old) | |||
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | /** | 1014 | /** |
1015 | * smack_kernel_act_as - Set the subjective context in a set of credentials | ||
1016 | * @new points to the set of credentials to be modified. | ||
1017 | * @secid specifies the security ID to be set | ||
1018 | * | ||
1019 | * Set the security data for a kernel service. | ||
1020 | */ | ||
1021 | static int smack_kernel_act_as(struct cred *new, u32 secid) | ||
1022 | { | ||
1023 | char *smack = smack_from_secid(secid); | ||
1024 | |||
1025 | if (smack == NULL) | ||
1026 | return -EINVAL; | ||
1027 | |||
1028 | new->security = smack; | ||
1029 | return 0; | ||
1030 | } | ||
1031 | |||
1032 | /** | ||
1033 | * smack_kernel_create_files_as - Set the file creation label in a set of creds | ||
1034 | * @new points to the set of credentials to be modified | ||
1035 | * @inode points to the inode to use as a reference | ||
1036 | * | ||
1037 | * Set the file creation context in a set of credentials to the same | ||
1038 | * as the objective context of the specified inode | ||
1039 | */ | ||
1040 | static int smack_kernel_create_files_as(struct cred *new, | ||
1041 | struct inode *inode) | ||
1042 | { | ||
1043 | struct inode_smack *isp = inode->i_security; | ||
1044 | |||
1045 | new->security = isp->smk_inode; | ||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
1049 | /** | ||
1015 | * smack_task_setpgid - Smack check on setting pgid | 1050 | * smack_task_setpgid - Smack check on setting pgid |
1016 | * @p: the task object | 1051 | * @p: the task object |
1017 | * @pgid: unused | 1052 | * @pgid: unused |
@@ -2641,6 +2676,8 @@ struct security_operations smack_ops = { | |||
2641 | .cred_free = smack_cred_free, | 2676 | .cred_free = smack_cred_free, |
2642 | .cred_prepare = smack_cred_prepare, | 2677 | .cred_prepare = smack_cred_prepare, |
2643 | .cred_commit = smack_cred_commit, | 2678 | .cred_commit = smack_cred_commit, |
2679 | .kernel_act_as = smack_kernel_act_as, | ||
2680 | .kernel_create_files_as = smack_kernel_create_files_as, | ||
2644 | .task_fix_setuid = cap_task_fix_setuid, | 2681 | .task_fix_setuid = cap_task_fix_setuid, |
2645 | .task_setpgid = smack_task_setpgid, | 2682 | .task_setpgid = smack_task_setpgid, |
2646 | .task_getpgid = smack_task_getpgid, | 2683 | .task_getpgid = smack_task_getpgid, |