summaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-10 21:43:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-10 21:43:43 -0400
commit028db3e290f15ac509084c0fc3b9d021f668f877 (patch)
tree7497244a90100f2464403063f88f83a555da03b3 /security/selinux/hooks.c
parente9a83bd2322035ed9d7dcf35753d3f984d76c6a5 (diff)
Revert "Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs"
This reverts merge 0f75ef6a9cff49ff612f7ce0578bced9d0b38325 (and thus effectively commits 7a1ade847596 ("keys: Provide KEYCTL_GRANT_PERMISSION") 2e12256b9a76 ("keys: Replace uid/gid/perm permissions checking with an ACL") that the merge brought in). It turns out that it breaks booting with an encrypted volume, and Eric biggers reports that it also breaks the fscrypt tests [1] and loading of in-kernel X.509 certificates [2]. The root cause of all the breakage is likely the same, but David Howells is off email so rather than try to work it out it's getting reverted in order to not impact the rest of the merge window. [1] https://lore.kernel.org/lkml/20190710011559.GA7973@sol.localdomain/ [2] https://lore.kernel.org/lkml/20190710013225.GB7973@sol.localdomain/ Link: https://lore.kernel.org/lkml/CAHk-=wjxoeMJfeBahnWH=9zShKp2bsVy527vo3_y8HfOdhwAAw@mail.gmail.com/ Reported-by: Eric Biggers <ebiggers@kernel.org> Cc: David Howells <dhowells@redhat.com> Cc: James Morris <jmorris@namei.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 4bef86ed463b..74dd46de01b6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -6502,7 +6502,6 @@ static int selinux_key_permission(key_ref_t key_ref,
6502{ 6502{
6503 struct key *key; 6503 struct key *key;
6504 struct key_security_struct *ksec; 6504 struct key_security_struct *ksec;
6505 unsigned oldstyle_perm;
6506 u32 sid; 6505 u32 sid;
6507 6506
6508 /* if no specific permissions are requested, we skip the 6507 /* if no specific permissions are requested, we skip the
@@ -6511,26 +6510,13 @@ static int selinux_key_permission(key_ref_t key_ref,
6511 if (perm == 0) 6510 if (perm == 0)
6512 return 0; 6511 return 0;
6513 6512
6514 oldstyle_perm = perm & (KEY_NEED_VIEW | KEY_NEED_READ | KEY_NEED_WRITE |
6515 KEY_NEED_SEARCH | KEY_NEED_LINK);
6516 if (perm & KEY_NEED_SETSEC)
6517 oldstyle_perm |= OLD_KEY_NEED_SETATTR;
6518 if (perm & KEY_NEED_INVAL)
6519 oldstyle_perm |= KEY_NEED_SEARCH;
6520 if (perm & KEY_NEED_REVOKE && !(perm & OLD_KEY_NEED_SETATTR))
6521 oldstyle_perm |= KEY_NEED_WRITE;
6522 if (perm & KEY_NEED_JOIN)
6523 oldstyle_perm |= KEY_NEED_SEARCH;
6524 if (perm & KEY_NEED_CLEAR)
6525 oldstyle_perm |= KEY_NEED_WRITE;
6526
6527 sid = cred_sid(cred); 6513 sid = cred_sid(cred);
6528 6514
6529 key = key_ref_to_ptr(key_ref); 6515 key = key_ref_to_ptr(key_ref);
6530 ksec = key->security; 6516 ksec = key->security;
6531 6517
6532 return avc_has_perm(&selinux_state, 6518 return avc_has_perm(&selinux_state,
6533 sid, ksec->sid, SECCLASS_KEY, oldstyle_perm, NULL); 6519 sid, ksec->sid, SECCLASS_KEY, perm, NULL);
6534} 6520}
6535 6521
6536static int selinux_key_getsecurity(struct key *key, char **_buffer) 6522static int selinux_key_getsecurity(struct key *key, char **_buffer)