mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
lsm: use lsm_prop in security_audit_rule_match
Change the secid parameter of security_audit_rule_match to a lsm_prop structure pointer. Pass the entry from the lsm_prop structure for the approprite slot to the LSM hook. Change the users of security_audit_rule_match to use the lsm_prop instead of a u32. The scaffolding function lsmprop_init() fills the structure with the value of the old secid, ensuring that it is available to the appropriate module hook. The sources of the secid, security_task_getsecid() and security_inode_getsecid(), will be converted to use the lsm_prop structure later in the series. At that point the use of lsmprop_init() is dropped. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> [PM: subject line tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
committed by
Paul Moore
parent
ed870e35db
commit
870b7fdc66
@@ -635,7 +635,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule,
|
||||
return false;
|
||||
for (i = 0; i < MAX_LSM_RULES; i++) {
|
||||
int rc = 0;
|
||||
u32 osid;
|
||||
struct lsm_prop prop = { };
|
||||
|
||||
if (!lsm_rule->lsm[i].rule) {
|
||||
if (!lsm_rule->lsm[i].args_p)
|
||||
@@ -649,15 +649,18 @@ retry:
|
||||
case LSM_OBJ_USER:
|
||||
case LSM_OBJ_ROLE:
|
||||
case LSM_OBJ_TYPE:
|
||||
security_inode_getsecid(inode, &osid);
|
||||
rc = ima_filter_rule_match(osid, lsm_rule->lsm[i].type,
|
||||
/* scaffolding */
|
||||
security_inode_getsecid(inode, &prop.scaffold.secid);
|
||||
rc = ima_filter_rule_match(&prop, lsm_rule->lsm[i].type,
|
||||
Audit_equal,
|
||||
lsm_rule->lsm[i].rule);
|
||||
break;
|
||||
case LSM_SUBJ_USER:
|
||||
case LSM_SUBJ_ROLE:
|
||||
case LSM_SUBJ_TYPE:
|
||||
rc = ima_filter_rule_match(secid, lsm_rule->lsm[i].type,
|
||||
/* scaffolding */
|
||||
prop.scaffold.secid = secid;
|
||||
rc = ima_filter_rule_match(&prop, lsm_rule->lsm[i].type,
|
||||
Audit_equal,
|
||||
lsm_rule->lsm[i].rule);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user