diff options
author | Dmitry Kasatkin <dmitry.kasatkin@intel.com> | 2012-09-12 17:51:32 (GMT) |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2012-09-13 18:23:57 (GMT) |
commit | 45e2472e67bf66f794d507b52e82af92e0614e49 (patch) | |
tree | 4b3ba557d4f9da9bca14ce85bee965e4a9fcd6ac /security/integrity/ima/ima_policy.c | |
parent | d9d300cdb6f233c4c591348919c758062198a4f4 (diff) | |
download | linux-45e2472e67bf66f794d507b52e82af92e0614e49.tar.xz |
ima: generic IMA action flag handling
Make the IMA action flag handling generic in order to support
additional new actions, without requiring changes to the base
implementation. New actions, like audit logging, will only
need to modify the define statements.
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_policy.c')
-rw-r--r-- | security/integrity/ima/ima_policy.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 0d6d60b..f46f685 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -26,13 +26,11 @@ #define IMA_UID 0x0008 #define IMA_FOWNER 0x0010 -#define UNKNOWN 0 -#define MEASURE 1 /* same as IMA_MEASURE */ -#define DONT_MEASURE 2 -#define MEASURE_MASK 3 -#define APPRAISE 4 /* same as IMA_APPRAISE */ -#define DONT_APPRAISE 8 -#define APPRAISE_MASK 12 +#define UNKNOWN 0 +#define MEASURE 0x0001 /* same as IMA_MEASURE */ +#define DONT_MEASURE 0x0002 +#define APPRAISE 0x0004 /* same as IMA_APPRAISE */ +#define DONT_APPRAISE 0x0008 #define MAX_LSM_RULES 6 enum lsm_rule_types { LSM_OBJ_USER, LSM_OBJ_ROLE, LSM_OBJ_TYPE, @@ -209,9 +207,12 @@ int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask, if (!ima_match_rules(entry, inode, func, mask)) continue; - action |= (entry->action & (IMA_APPRAISE | IMA_MEASURE)); - actmask &= (entry->action & APPRAISE_MASK) ? - ~APPRAISE_MASK : ~MEASURE_MASK; + action |= entry->action & IMA_DO_MASK; + if (entry->action & IMA_DO_MASK) + actmask &= ~(entry->action | entry->action << 1); + else + actmask &= ~(entry->action | entry->action >> 1); + if (!actmask) break; } |