diff options
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r-- | security/smack/smack_lsm.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 2d6e9bdea398..11f79013ae1f 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1442,9 +1442,13 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) | |||
1442 | * Don't do anything special for these. | 1442 | * Don't do anything special for these. |
1443 | * XATTR_NAME_SMACKIPIN | 1443 | * XATTR_NAME_SMACKIPIN |
1444 | * XATTR_NAME_SMACKIPOUT | 1444 | * XATTR_NAME_SMACKIPOUT |
1445 | * XATTR_NAME_SMACKEXEC | ||
1446 | */ | 1445 | */ |
1447 | if (strcmp(name, XATTR_NAME_SMACK) == 0) | 1446 | if (strcmp(name, XATTR_NAME_SMACK) == 0) { |
1447 | struct super_block *sbp = d_backing_inode(dentry)->i_sb; | ||
1448 | struct superblock_smack *sbsp = sbp->s_security; | ||
1449 | |||
1450 | isp->smk_inode = sbsp->smk_default; | ||
1451 | } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0) | ||
1448 | isp->smk_task = NULL; | 1452 | isp->smk_task = NULL; |
1449 | else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) | 1453 | else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) |
1450 | isp->smk_mmap = NULL; | 1454 | isp->smk_mmap = NULL; |
@@ -1545,12 +1549,8 @@ static void smack_inode_getsecid(struct inode *inode, u32 *secid) | |||
1545 | * File Hooks | 1549 | * File Hooks |
1546 | */ | 1550 | */ |
1547 | 1551 | ||
1548 | /** | 1552 | /* |
1549 | * smack_file_permission - Smack check on file operations | 1553 | * There is no smack_file_permission hook |
1550 | * @file: unused | ||
1551 | * @mask: unused | ||
1552 | * | ||
1553 | * Returns 0 | ||
1554 | * | 1554 | * |
1555 | * Should access checks be done on each read or write? | 1555 | * Should access checks be done on each read or write? |
1556 | * UNICOS and SELinux say yes. | 1556 | * UNICOS and SELinux say yes. |
@@ -1559,10 +1559,6 @@ static void smack_inode_getsecid(struct inode *inode, u32 *secid) | |||
1559 | * I'll say no for now. Smack does not do the frequent | 1559 | * I'll say no for now. Smack does not do the frequent |
1560 | * label changing that SELinux does. | 1560 | * label changing that SELinux does. |
1561 | */ | 1561 | */ |
1562 | static int smack_file_permission(struct file *file, int mask) | ||
1563 | { | ||
1564 | return 0; | ||
1565 | } | ||
1566 | 1562 | ||
1567 | /** | 1563 | /** |
1568 | * smack_file_alloc_security - assign a file security blob | 1564 | * smack_file_alloc_security - assign a file security blob |
@@ -4503,16 +4499,10 @@ static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule, | |||
4503 | return 0; | 4499 | return 0; |
4504 | } | 4500 | } |
4505 | 4501 | ||
4506 | /** | 4502 | /* |
4507 | * smack_audit_rule_free - free smack rule representation | 4503 | * There is no need for a smack_audit_rule_free hook. |
4508 | * @vrule: rule to be freed. | ||
4509 | * | ||
4510 | * No memory was allocated. | 4504 | * No memory was allocated. |
4511 | */ | 4505 | */ |
4512 | static void smack_audit_rule_free(void *vrule) | ||
4513 | { | ||
4514 | /* No-op */ | ||
4515 | } | ||
4516 | 4506 | ||
4517 | #endif /* CONFIG_AUDIT */ | 4507 | #endif /* CONFIG_AUDIT */ |
4518 | 4508 | ||
@@ -4563,16 +4553,11 @@ static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) | |||
4563 | return 0; | 4553 | return 0; |
4564 | } | 4554 | } |
4565 | 4555 | ||
4566 | /** | 4556 | /* |
4567 | * smack_release_secctx - don't do anything. | 4557 | * There used to be a smack_release_secctx hook |
4568 | * @secdata: unused | 4558 | * that did nothing back when hooks were in a vector. |
4569 | * @seclen: unused | 4559 | * Now that there's a list such a hook adds cost. |
4570 | * | ||
4571 | * Exists to make sure nothing gets done, and properly | ||
4572 | */ | 4560 | */ |
4573 | static void smack_release_secctx(char *secdata, u32 seclen) | ||
4574 | { | ||
4575 | } | ||
4576 | 4561 | ||
4577 | static int smack_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) | 4562 | static int smack_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) |
4578 | { | 4563 | { |
@@ -4631,7 +4616,6 @@ static struct security_hook_list smack_hooks[] = { | |||
4631 | LSM_HOOK_INIT(inode_listsecurity, smack_inode_listsecurity), | 4616 | LSM_HOOK_INIT(inode_listsecurity, smack_inode_listsecurity), |
4632 | LSM_HOOK_INIT(inode_getsecid, smack_inode_getsecid), | 4617 | LSM_HOOK_INIT(inode_getsecid, smack_inode_getsecid), |
4633 | 4618 | ||
4634 | LSM_HOOK_INIT(file_permission, smack_file_permission), | ||
4635 | LSM_HOOK_INIT(file_alloc_security, smack_file_alloc_security), | 4619 | LSM_HOOK_INIT(file_alloc_security, smack_file_alloc_security), |
4636 | LSM_HOOK_INIT(file_free_security, smack_file_free_security), | 4620 | LSM_HOOK_INIT(file_free_security, smack_file_free_security), |
4637 | LSM_HOOK_INIT(file_ioctl, smack_file_ioctl), | 4621 | LSM_HOOK_INIT(file_ioctl, smack_file_ioctl), |
@@ -4726,13 +4710,11 @@ static struct security_hook_list smack_hooks[] = { | |||
4726 | LSM_HOOK_INIT(audit_rule_init, smack_audit_rule_init), | 4710 | LSM_HOOK_INIT(audit_rule_init, smack_audit_rule_init), |
4727 | LSM_HOOK_INIT(audit_rule_known, smack_audit_rule_known), | 4711 | LSM_HOOK_INIT(audit_rule_known, smack_audit_rule_known), |
4728 | LSM_HOOK_INIT(audit_rule_match, smack_audit_rule_match), | 4712 | LSM_HOOK_INIT(audit_rule_match, smack_audit_rule_match), |
4729 | LSM_HOOK_INIT(audit_rule_free, smack_audit_rule_free), | ||
4730 | #endif /* CONFIG_AUDIT */ | 4713 | #endif /* CONFIG_AUDIT */ |
4731 | 4714 | ||
4732 | LSM_HOOK_INIT(ismaclabel, smack_ismaclabel), | 4715 | LSM_HOOK_INIT(ismaclabel, smack_ismaclabel), |
4733 | LSM_HOOK_INIT(secid_to_secctx, smack_secid_to_secctx), | 4716 | LSM_HOOK_INIT(secid_to_secctx, smack_secid_to_secctx), |
4734 | LSM_HOOK_INIT(secctx_to_secid, smack_secctx_to_secid), | 4717 | LSM_HOOK_INIT(secctx_to_secid, smack_secctx_to_secid), |
4735 | LSM_HOOK_INIT(release_secctx, smack_release_secctx), | ||
4736 | LSM_HOOK_INIT(inode_notifysecctx, smack_inode_notifysecctx), | 4718 | LSM_HOOK_INIT(inode_notifysecctx, smack_inode_notifysecctx), |
4737 | LSM_HOOK_INIT(inode_setsecctx, smack_inode_setsecctx), | 4719 | LSM_HOOK_INIT(inode_setsecctx, smack_inode_setsecctx), |
4738 | LSM_HOOK_INIT(inode_getsecctx, smack_inode_getsecctx), | 4720 | LSM_HOOK_INIT(inode_getsecctx, smack_inode_getsecctx), |