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 03d37d25e0
("LSM/Audit: Introduce generic
Audit LSM hooks") but appears to have never been used.
Remove it.
Please see the github issue
https://github.com/linux-audit/audit-kernel/issues/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>
This commit is contained in:
parent
57d4657716
commit
90462a5bd3
|
@ -1344,7 +1344,6 @@
|
||||||
* @field contains the field which relates to current LSM.
|
* @field contains the field which relates to current LSM.
|
||||||
* @op contains the operator that will be used for matching.
|
* @op contains the operator that will be used for matching.
|
||||||
* @rule points to the audit rule that will be checked against.
|
* @rule points to the audit rule that will be checked against.
|
||||||
* @actx points to the audit context associated with the check.
|
|
||||||
* Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
|
* Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure.
|
||||||
*
|
*
|
||||||
* @audit_rule_free:
|
* @audit_rule_free:
|
||||||
|
@ -1764,8 +1763,7 @@ union security_list_options {
|
||||||
int (*audit_rule_init)(u32 field, u32 op, char *rulestr,
|
int (*audit_rule_init)(u32 field, u32 op, char *rulestr,
|
||||||
void **lsmrule);
|
void **lsmrule);
|
||||||
int (*audit_rule_known)(struct audit_krule *krule);
|
int (*audit_rule_known)(struct audit_krule *krule);
|
||||||
int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule,
|
int (*audit_rule_match)(u32 secid, u32 field, u32 op, void *lsmrule);
|
||||||
struct audit_context *actx);
|
|
||||||
void (*audit_rule_free)(void *lsmrule);
|
void (*audit_rule_free)(void *lsmrule);
|
||||||
#endif /* CONFIG_AUDIT */
|
#endif /* CONFIG_AUDIT */
|
||||||
|
|
||||||
|
|
|
@ -1674,8 +1674,7 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
|
||||||
#ifdef CONFIG_SECURITY
|
#ifdef CONFIG_SECURITY
|
||||||
int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
|
int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
|
||||||
int security_audit_rule_known(struct audit_krule *krule);
|
int security_audit_rule_known(struct audit_krule *krule);
|
||||||
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
|
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule);
|
||||||
struct audit_context *actx);
|
|
||||||
void security_audit_rule_free(void *lsmrule);
|
void security_audit_rule_free(void *lsmrule);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -1692,7 +1691,7 @@ static inline int security_audit_rule_known(struct audit_krule *krule)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
|
static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
|
||||||
void *lsmrule, struct audit_context *actx)
|
void *lsmrule)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ int audit_filter(int msgtype, unsigned int listtype)
|
||||||
if (f->lsm_rule) {
|
if (f->lsm_rule) {
|
||||||
security_task_getsecid(current, &sid);
|
security_task_getsecid(current, &sid);
|
||||||
result = security_audit_rule_match(sid,
|
result = security_audit_rule_match(sid,
|
||||||
f->type, f->op, f->lsm_rule, NULL);
|
f->type, f->op, f->lsm_rule);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AUDIT_EXE:
|
case AUDIT_EXE:
|
||||||
|
|
|
@ -631,9 +631,8 @@ static int audit_filter_rules(struct task_struct *tsk,
|
||||||
need_sid = 0;
|
need_sid = 0;
|
||||||
}
|
}
|
||||||
result = security_audit_rule_match(sid, f->type,
|
result = security_audit_rule_match(sid, f->type,
|
||||||
f->op,
|
f->op,
|
||||||
f->lsm_rule,
|
f->lsm_rule);
|
||||||
ctx);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AUDIT_OBJ_USER:
|
case AUDIT_OBJ_USER:
|
||||||
|
@ -647,13 +646,17 @@ static int audit_filter_rules(struct task_struct *tsk,
|
||||||
/* Find files that match */
|
/* Find files that match */
|
||||||
if (name) {
|
if (name) {
|
||||||
result = security_audit_rule_match(
|
result = security_audit_rule_match(
|
||||||
name->osid, f->type, f->op,
|
name->osid,
|
||||||
f->lsm_rule, ctx);
|
f->type,
|
||||||
|
f->op,
|
||||||
|
f->lsm_rule);
|
||||||
} else if (ctx) {
|
} else if (ctx) {
|
||||||
list_for_each_entry(n, &ctx->names_list, list) {
|
list_for_each_entry(n, &ctx->names_list, list) {
|
||||||
if (security_audit_rule_match(n->osid, f->type,
|
if (security_audit_rule_match(
|
||||||
f->op, f->lsm_rule,
|
n->osid,
|
||||||
ctx)) {
|
f->type,
|
||||||
|
f->op,
|
||||||
|
f->lsm_rule)) {
|
||||||
++result;
|
++result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -664,7 +667,7 @@ static int audit_filter_rules(struct task_struct *tsk,
|
||||||
break;
|
break;
|
||||||
if (security_audit_rule_match(ctx->ipc.osid,
|
if (security_audit_rule_match(ctx->ipc.osid,
|
||||||
f->type, f->op,
|
f->type, f->op,
|
||||||
f->lsm_rule, ctx))
|
f->lsm_rule))
|
||||||
++result;
|
++result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -225,8 +225,7 @@ int aa_audit_rule_known(struct audit_krule *rule)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
|
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule)
|
||||||
struct audit_context *actx)
|
|
||||||
{
|
{
|
||||||
struct aa_audit_rule *rule = vrule;
|
struct aa_audit_rule *rule = vrule;
|
||||||
struct aa_label *label;
|
struct aa_label *label;
|
||||||
|
|
|
@ -192,7 +192,6 @@ static inline int complain_error(int error)
|
||||||
void aa_audit_rule_free(void *vrule);
|
void aa_audit_rule_free(void *vrule);
|
||||||
int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule);
|
int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule);
|
||||||
int aa_audit_rule_known(struct audit_krule *rule);
|
int aa_audit_rule_known(struct audit_krule *rule);
|
||||||
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
|
int aa_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule);
|
||||||
struct audit_context *actx);
|
|
||||||
|
|
||||||
#endif /* __AA_AUDIT_H */
|
#endif /* __AA_AUDIT_H */
|
||||||
|
|
|
@ -307,8 +307,7 @@ static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
|
static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
|
||||||
void *lsmrule,
|
void *lsmrule)
|
||||||
struct audit_context *actx)
|
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,8 +340,7 @@ retry:
|
||||||
rc = security_filter_rule_match(osid,
|
rc = security_filter_rule_match(osid,
|
||||||
rule->lsm[i].type,
|
rule->lsm[i].type,
|
||||||
Audit_equal,
|
Audit_equal,
|
||||||
rule->lsm[i].rule,
|
rule->lsm[i].rule);
|
||||||
NULL);
|
|
||||||
break;
|
break;
|
||||||
case LSM_SUBJ_USER:
|
case LSM_SUBJ_USER:
|
||||||
case LSM_SUBJ_ROLE:
|
case LSM_SUBJ_ROLE:
|
||||||
|
@ -349,8 +348,7 @@ retry:
|
||||||
rc = security_filter_rule_match(secid,
|
rc = security_filter_rule_match(secid,
|
||||||
rule->lsm[i].type,
|
rule->lsm[i].type,
|
||||||
Audit_equal,
|
Audit_equal,
|
||||||
rule->lsm[i].rule,
|
rule->lsm[i].rule);
|
||||||
NULL);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1783,11 +1783,9 @@ void security_audit_rule_free(void *lsmrule)
|
||||||
call_void_hook(audit_rule_free, lsmrule);
|
call_void_hook(audit_rule_free, lsmrule);
|
||||||
}
|
}
|
||||||
|
|
||||||
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
|
int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule)
|
||||||
struct audit_context *actx)
|
|
||||||
{
|
{
|
||||||
return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule,
|
return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule);
|
||||||
actx);
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_AUDIT */
|
#endif /* CONFIG_AUDIT */
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,11 @@ void selinux_audit_rule_free(void *rule);
|
||||||
* @field: the field this rule refers to
|
* @field: the field this rule refers to
|
||||||
* @op: the operater the rule uses
|
* @op: the operater the rule uses
|
||||||
* @rule: pointer to the audit rule to check against
|
* @rule: pointer to the audit rule to check against
|
||||||
* @actx: the audit context (can be NULL) associated with the check
|
|
||||||
*
|
*
|
||||||
* Returns 1 if the context id matches the rule, 0 if it does not, and
|
* Returns 1 if the context id matches the rule, 0 if it does not, and
|
||||||
* -errno on failure.
|
* -errno on failure.
|
||||||
*/
|
*/
|
||||||
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule,
|
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule);
|
||||||
struct audit_context *actx);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* selinux_audit_rule_known - check to see if rule contains selinux fields.
|
* selinux_audit_rule_known - check to see if rule contains selinux fields.
|
||||||
|
|
|
@ -3376,8 +3376,7 @@ int selinux_audit_rule_known(struct audit_krule *rule)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
|
int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule)
|
||||||
struct audit_context *actx)
|
|
||||||
{
|
{
|
||||||
struct selinux_state *state = &selinux_state;
|
struct selinux_state *state = &selinux_state;
|
||||||
struct context *ctxt;
|
struct context *ctxt;
|
||||||
|
|
|
@ -4393,13 +4393,11 @@ static int smack_audit_rule_known(struct audit_krule *krule)
|
||||||
* @field: audit rule flags given from user-space
|
* @field: audit rule flags given from user-space
|
||||||
* @op: required testing operator
|
* @op: required testing operator
|
||||||
* @vrule: smack internal rule presentation
|
* @vrule: smack internal rule presentation
|
||||||
* @actx: audit context associated with the check
|
|
||||||
*
|
*
|
||||||
* The core Audit hook. It's used to take the decision of
|
* The core Audit hook. It's used to take the decision of
|
||||||
* whether to audit or not to audit a given object.
|
* whether to audit or not to audit a given object.
|
||||||
*/
|
*/
|
||||||
static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule,
|
static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule)
|
||||||
struct audit_context *actx)
|
|
||||||
{
|
{
|
||||||
struct smack_known *skp;
|
struct smack_known *skp;
|
||||||
char *rule = vrule;
|
char *rule = vrule;
|
||||||
|
|
Loading…
Reference in New Issue