Skip to content

Commit 90462a5

Browse files
rgbriggspcmoore
authored andcommitted
audit: remove unused actx param from audit_rule_match
The audit_rule_match() struct audit_context *actx parameter is not used by any in-tree consumers (selinux, apparmour, integrity, smack). The audit context is an internal audit structure that should only be accessed by audit accessor functions. It was part of commit 03d37d2 ("LSM/Audit: Introduce generic Audit LSM hooks") but appears to have never been used. Remove it. Please see the github issue linux-audit/audit-kernel#107 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> [PM: fixed the referenced commit title] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 57d4657 commit 90462a5

12 files changed

Lines changed: 26 additions & 38 deletions

File tree

‎include/linux/lsm_hooks.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,6 @@
13441344
* @field contains the field which relates to current LSM.
13451345
* @op contains the operator that will be used for matching.
13461346
* @rule points to the audit rule that will be checked against.
1347-
* @actx points to the audit context associated with the check.
13481347
* Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
13491348
*
13501349
* @audit_rule_free:
@@ -1764,8 +1763,7 @@ union security_list_options {
17641763
int (*audit_rule_init)(u32 field, u32 op, char *rulestr,
17651764
void **lsmrule);
17661765
int (*audit_rule_known)(struct audit_krule *krule);
1767-
int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule,
1768-
struct audit_context *actx);
1766+
int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule);
17691767
void (*audit_rule_free)(void *lsmrule);
17701768
#endif /* CONFIG_AUDIT */
17711769

‎include/linux/security.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,7 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
16741674
#ifdef CONFIG_SECURITY
16751675
int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
16761676
int security_audit_rule_known(struct audit_krule *krule);
1677-
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
1678-
struct audit_context *actx);
1677+
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule);
16791678
void security_audit_rule_free(void *lsmrule);
16801679

16811680
#else
@@ -1692,7 +1691,7 @@ static inline int security_audit_rule_known(struct audit_krule *krule)
16921691
}
16931692

16941693
static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
1695-
void *lsmrule, struct audit_context *actx)
1694+
void *lsmrule)
16961695
{
16971696
return 0;
16981697
}

‎kernel/auditfilter.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ int audit_filter(int msgtype, unsigned int listtype)
13551355
if (f->lsm_rule) {
13561356
security_task_getsecid(current, &sid);
13571357
result = security_audit_rule_match(sid,
1358-
f->type, f->op, f->lsm_rule, NULL);
1358+
f->type, f->op, f->lsm_rule);
13591359
}
13601360
break;
13611361
case AUDIT_EXE:

‎kernel/auditsc.c‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,8 @@ static int audit_filter_rules(struct task_struct *tsk,
631631
need_sid = 0;
632632
}
633633
result = security_audit_rule_match(sid, f->type,
634-
f->op,
635-
f->lsm_rule,
636-
ctx);
634+
f->op,
635+
f->lsm_rule);
637636
}
638637
break;
639638
case AUDIT_OBJ_USER:
@@ -647,13 +646,17 @@ static int audit_filter_rules(struct task_struct *tsk,
647646
/* Find files that match */
648647
if (name) {
649648
result = security_audit_rule_match(
650-
name->osid, f->type, f->op,
651-
f->lsm_rule, ctx);
649+
name->osid,
650+
f->type,
651+
f->op,
652+
f->lsm_rule);
652653
} else if (ctx) {
653654
list_for_each_entry(n, &ctx->names_list, list) {
654-
if (security_audit_rule_match(n->osid, f->type,
655-
f->op, f->lsm_rule,
656-
ctx)) {
655+
if (security_audit_rule_match(
656+
n->osid,
657+
f->type,
658+
f->op,
659+
f->lsm_rule)) {
657660
++result;
658661
break;
659662
}
@@ -664,7 +667,7 @@ static int audit_filter_rules(struct task_struct *tsk,
664667
break;
665668
if (security_audit_rule_match(ctx->ipc.osid,
666669
f->type, f->op,
667-
f->lsm_rule, ctx))
670+
f->lsm_rule))
668671
++result;
669672
}
670673
break;

‎security/apparmor/audit.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ int aa_audit_rule_known(struct audit_krule *rule)
225225
return 0;
226226
}
227227

228-
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
229-
struct audit_context *actx)
228+
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule)
230229
{
231230
struct aa_audit_rule *rule = vrule;
232231
struct aa_label *label;

‎security/apparmor/include/audit.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ static inline int complain_error(int error)
192192
void aa_audit_rule_free(void *vrule);
193193
int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule);
194194
int aa_audit_rule_known(struct audit_krule *rule);
195-
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
196-
struct audit_context *actx);
195+
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule);
197196

198197
#endif /* __AA_AUDIT_H */

‎security/integrity/ima/ima.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr,
307307
}
308308

309309
static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
310-
void *lsmrule,
311-
struct audit_context *actx)
310+
void *lsmrule)
312311
{
313312
return -EINVAL;
314313
}

‎security/integrity/ima/ima_policy.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,17 +340,15 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
340340
rc = security_filter_rule_match(osid,
341341
rule->lsm[i].type,
342342
Audit_equal,
343-
rule->lsm[i].rule,
344-
NULL);
343+
rule->lsm[i].rule);
345344
break;
346345
case LSM_SUBJ_USER:
347346
case LSM_SUBJ_ROLE:
348347
case LSM_SUBJ_TYPE:
349348
rc = security_filter_rule_match(secid,
350349
rule->lsm[i].type,
351350
Audit_equal,
352-
rule->lsm[i].rule,
353-
NULL);
351+
rule->lsm[i].rule);
354352
default:
355353
break;
356354
}

‎security/security.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,11 +1783,9 @@ void security_audit_rule_free(void *lsmrule)
17831783
call_void_hook(audit_rule_free, lsmrule);
17841784
}
17851785

1786-
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
1787-
struct audit_context *actx)
1786+
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule)
17881787
{
1789-
return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule,
1790-
actx);
1788+
return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule);
17911789
}
17921790
#endif /* CONFIG_AUDIT */
17931791

‎security/selinux/include/audit.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ void selinux_audit_rule_free(void *rule);
4646
* @field: the field this rule refers to
4747
* @op: the operater the rule uses
4848
* @rule: pointer to the audit rule to check against
49-
* @actx: the audit context (can be NULL) associated with the check
5049
*
5150
* Returns 1 if the context id matches the rule, 0 if it does not, and
5251
* -errno on failure.
5352
*/
54-
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule,
55-
struct audit_context *actx);
53+
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule);
5654

5755
/**
5856
* selinux_audit_rule_known - check to see if rule contains selinux fields.

0 commit comments

Comments
 (0)