All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SELinux: requesting no permissions in avc_has_perm_noaudit is a BUG()
@ 2008-03-11 18:19 Eric Paris
  2008-03-11 18:35 ` Stephen Smalley
  2008-03-11 22:16 ` James Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Paris @ 2008-03-11 18:19 UTC (permalink / raw)
  To: selinux; +Cc: sds, jmorris

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: Eric Paris <eparis@redhat.com>

---

 security/selinux/avc.c         |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 187964e..cb3f0ce 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -871,6 +871,8 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
 	int rc = 0;
 	u32 denied;
 
+	BUG_ON(!requested);
+
 	rcu_read_lock();
 
 	node = avc_lookup(ssid, tsid, tclass, requested);
@@ -890,7 +892,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
 
 	denied = requested & ~(p_ae->avd.allowed);
 
-	if (!requested || denied) {
+	if (denied) {
 		if (selinux_enforcing || (flags & AVC_STRICT))
 			rc = -EACCES;
 		else


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-03-12 17:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11 18:19 [PATCH] SELinux: requesting no permissions in avc_has_perm_noaudit is a BUG() Eric Paris
2008-03-11 18:35 ` Stephen Smalley
2008-03-11 22:16 ` James Morris
2008-03-11 22:26   ` James Morris
2008-03-12  1:10     ` Eric Paris
2008-03-12 13:05       ` Stephen Smalley
2008-03-12 15:31     ` Eric Paris
2008-03-12 17:18       ` Stephen Smalley
2008-03-12 17:40         ` Eric Paris
2008-03-12 16:44     ` Eric Paris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.