summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2015-02-05 10:44:50 -0600
committerEric W. Biederman <ebiederm@xmission.com>2016-07-05 15:13:10 -0500
commit0b3c9761d1e405514a551ed24d3ea89aea26ce14 (patch)
tree89788915d79a0a32b078780ab9181e3c76a13200 /security
parent5c0048280babd579fa9e5f0e787122b06aee3f3b (diff)
downloadlinux-0b3c9761d1e405514a551ed24d3ea89aea26ce14.tar.bz2
evm: Translate user/group ids relative to s_user_ns when computing HMAC
The EVM HMAC should be calculated using the on disk user and group ids, so the k[ug]ids in the inode must be translated relative to the s_user_ns of the inode's super block. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/evm/evm_crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 30b6b7d0429f..11c1d30bd705 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -151,8 +151,8 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
memset(&hmac_misc, 0, sizeof(hmac_misc));
hmac_misc.ino = inode->i_ino;
hmac_misc.generation = inode->i_generation;
- hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid);
- hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid);
+ hmac_misc.uid = from_kuid(inode->i_sb->s_user_ns, inode->i_uid);
+ hmac_misc.gid = from_kgid(inode->i_sb->s_user_ns, inode->i_gid);
hmac_misc.mode = inode->i_mode;
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
if (evm_hmac_attrs & EVM_ATTR_FSUUID)