Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264544
b: refs/heads/master
c: 566be59
h: refs/heads/master
v: v3
  • Loading branch information
Mimi Zohar committed Sep 14, 2011
1 parent 8a5b7b2 commit 087a74e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf6d0f5dcda17df3cc5577e203d0f8ea1c2ad6aa
refs/heads/master: 566be59ab86c0e030b980645a580d683a015a483
1 change: 1 addition & 0 deletions trunk/include/linux/integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum integrity_status {
INTEGRITY_PASS = 0,
INTEGRITY_FAIL,
INTEGRITY_NOLABEL,
INTEGRITY_NOXATTRS,
INTEGRITY_UNKNOWN,
};

Expand Down
30 changes: 13 additions & 17 deletions trunk/security/integrity/evm/evm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
struct integrity_iint_cache *iint)
{
struct evm_ima_xattr_data xattr_data;
enum integrity_status evm_status;
enum integrity_status evm_status = INTEGRITY_PASS;
int rc;

if (iint && iint->evm_status == INTEGRITY_PASS)
Expand All @@ -76,25 +76,18 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,

rc = evm_calc_hmac(dentry, xattr_name, xattr_value,
xattr_value_len, xattr_data.digest);
if (rc < 0)
goto err_out;
if (rc < 0) {
evm_status = (rc == -ENODATA)
? INTEGRITY_NOXATTRS : INTEGRITY_FAIL;
goto out;
}

xattr_data.type = EVM_XATTR_HMAC;
rc = vfs_xattr_cmp(dentry, XATTR_NAME_EVM, (u8 *)&xattr_data,
sizeof xattr_data, GFP_NOFS);
if (rc < 0)
goto err_out;
evm_status = INTEGRITY_PASS;
goto out;

err_out:
switch (rc) {
case -ENODATA: /* file not labelled */
evm_status = INTEGRITY_NOLABEL;
break;
default:
evm_status = INTEGRITY_FAIL;
}
evm_status = (rc == -ENODATA)
? INTEGRITY_NOLABEL : INTEGRITY_FAIL;
out:
if (iint)
iint->evm_status = evm_status;
Expand Down Expand Up @@ -199,7 +192,7 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
return 0;
evm_status = evm_verify_current_integrity(dentry);
if ((evm_status == INTEGRITY_PASS) ||
(evm_status == INTEGRITY_NOLABEL))
(evm_status == INTEGRITY_NOXATTRS))
return 0;
return -EPERM;
}
Expand Down Expand Up @@ -293,7 +286,10 @@ int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
if (!(ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)))
return 0;
evm_status = evm_verify_current_integrity(dentry);
return evm_status == INTEGRITY_PASS ? 0 : -EPERM;
if ((evm_status == INTEGRITY_PASS) ||
(evm_status == INTEGRITY_NOXATTRS))
return 0;
return -EPERM;
}

/**
Expand Down

0 comments on commit 087a74e

Please sign in to comment.