/* SPDX-License-Identifier: GPL-2.0-only */1/*2* SELinux support for the Audit LSM hooks3*4* Author: James Morris <[email protected]>5*6* Copyright (C) 2005 Red Hat, Inc., James Morris <[email protected]>7* Copyright (C) 2006 Trusted Computer Solutions, Inc. <[email protected]>8* Copyright (C) 2006 IBM Corporation, Timothy R. Chavez <[email protected]>9*/1011#ifndef _SELINUX_AUDIT_H12#define _SELINUX_AUDIT_H1314#include <linux/audit.h>15#include <linux/types.h>1617/**18* selinux_audit_rule_avc_callback - update the audit LSM rules on AVC events.19* @event: the AVC event20*21* Update any audit LSM rules based on the AVC event specified in @event.22* Returns 0 on success, negative values otherwise.23*/24int selinux_audit_rule_avc_callback(u32 event);2526/**27* selinux_audit_rule_init - alloc/init an selinux audit rule structure.28* @field: the field this rule refers to29* @op: the operator the rule uses30* @rulestr: the text "target" of the rule31* @rule: pointer to the new rule structure returned via this32* @gfp: GFP flag used for kmalloc33*34* Returns 0 if successful, -errno if not. On success, the rule structure35* will be allocated internally. The caller must free this structure with36* selinux_audit_rule_free() after use.37*/38int selinux_audit_rule_init(u32 field, u32 op, char *rulestr, void **rule,39gfp_t gfp);4041/**42* selinux_audit_rule_free - free an selinux audit rule structure.43* @rule: pointer to the audit rule to be freed44*45* This will free all memory associated with the given rule.46* If @rule is NULL, no operation is performed.47*/48void selinux_audit_rule_free(void *rule);4950/**51* selinux_audit_rule_match - determine if a context ID matches a rule.52* @prop: includes the context ID to check53* @field: the field this rule refers to54* @op: the operator the rule uses55* @rule: pointer to the audit rule to check against56*57* Returns 1 if the context id matches the rule, 0 if it does not, and58* -errno on failure.59*/60int selinux_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op,61void *rule);6263/**64* selinux_audit_rule_known - check to see if rule contains selinux fields.65* @rule: rule to be checked66* Returns 1 if there are selinux fields specified in the rule, 0 otherwise.67*/68int selinux_audit_rule_known(struct audit_krule *rule);6970#endif /* _SELINUX_AUDIT_H */717273