ima/policy: switch to use uuid_t
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
1dd771eb0b
commit
787d8c530a
|
@ -61,7 +61,7 @@ struct ima_rule_entry {
|
||||||
enum ima_hooks func;
|
enum ima_hooks func;
|
||||||
int mask;
|
int mask;
|
||||||
unsigned long fsmagic;
|
unsigned long fsmagic;
|
||||||
u8 fsuuid[16];
|
uuid_t fsuuid;
|
||||||
kuid_t uid;
|
kuid_t uid;
|
||||||
kuid_t fowner;
|
kuid_t fowner;
|
||||||
bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */
|
bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */
|
||||||
|
@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
|
||||||
&& rule->fsmagic != inode->i_sb->s_magic)
|
&& rule->fsmagic != inode->i_sb->s_magic)
|
||||||
return false;
|
return false;
|
||||||
if ((rule->flags & IMA_FSUUID) &&
|
if ((rule->flags & IMA_FSUUID) &&
|
||||||
memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
|
memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
|
||||||
return false;
|
return false;
|
||||||
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
|
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
|
||||||
return false;
|
return false;
|
||||||
|
@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
|
||||||
case Opt_fsuuid:
|
case Opt_fsuuid:
|
||||||
ima_log_string(ab, "fsuuid", args[0].from);
|
ima_log_string(ab, "fsuuid", args[0].from);
|
||||||
|
|
||||||
if (memchr_inv(entry->fsuuid, 0x00,
|
if (uuid_is_null(&entry->fsuuid)) {
|
||||||
sizeof(entry->fsuuid))) {
|
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = uuid_parse(args[0].from, (uuid_t *)&entry->fsuuid);
|
result = uuid_parse(args[0].from, &entry->fsuuid);
|
||||||
if (!result)
|
if (!result)
|
||||||
entry->flags |= IMA_FSUUID;
|
entry->flags |= IMA_FSUUID;
|
||||||
break;
|
break;
|
||||||
|
@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->flags & IMA_FSUUID) {
|
if (entry->flags & IMA_FSUUID) {
|
||||||
seq_printf(m, "fsuuid=%pU", entry->fsuuid);
|
seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
|
||||||
seq_puts(m, " ");
|
seq_puts(m, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue