Commit eda4f69c authored by Eric Paris's avatar Eric Paris Committed by James Morris

SELinux: requesting no permissions in avc_has_perm_noaudit is a BUG()

This patch turns the case where we have a call into avc_has_perm with no
requested permissions into a BUG_ON.  All callers to this should be in
the kernel and thus should be a function we need to fix if we ever hit
this.  The /selinux/access permission checking it done directly in the
security server and not through the avc, so those requests which we
cannot control from userspace should not be able to trigger this BUG_ON.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
Acked-by: default avatarStephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent f0115e6c
...@@ -871,6 +871,8 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, ...@@ -871,6 +871,8 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
int rc = 0; int rc = 0;
u32 denied; u32 denied;
BUG_ON(!requested);
rcu_read_lock(); rcu_read_lock();
node = avc_lookup(ssid, tsid, tclass, requested); node = avc_lookup(ssid, tsid, tclass, requested);
...@@ -890,7 +892,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, ...@@ -890,7 +892,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
denied = requested & ~(p_ae->avd.allowed); denied = requested & ~(p_ae->avd.allowed);
if (!requested || denied) { if (denied) {
if (selinux_enforcing || (flags & AVC_STRICT)) if (selinux_enforcing || (flags & AVC_STRICT))
rc = -EACCES; rc = -EACCES;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment