aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/avc.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-02-12 14:50:54 -0500
committerJames Morris <jmorris@namei.org>2009-02-13 17:23:08 -0500
commitf1c6381a6e337adcecf84be2a838bd9e610e2365 (patch)
treea6e0857db27a38b0976fb422836f9443241b4b61 /security/selinux/avc.c
parent21193dcd1f3570ddfd8a04f4465e484c1f94252f (diff)
SELinux: remove unused av.decided field
It appears there was an intention to have the security server only decide certain permissions and leave other for later as some sort of a portential performance win. We are currently always deciding all 32 bits of permissions and this is a useless couple of branches and wasted space. This patch completely drops the av.decided concept. This in a 17% reduction in the time spent in avc_has_perm_noaudit based on oprofile sampling of a tbench benchmark. Signed-off-by: Eric Paris <eparis@redhat.com> Reviewed-by: Paul Moore <paul.moore@hp.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux/avc.c')
-rw-r--r--security/selinux/avc.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 2a84dec4adfe..326aa78bd421 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -381,30 +381,25 @@ static inline struct avc_node *avc_search_node(u32 ssid, u32 tsid, u16 tclass)
381 * @ssid: source security identifier 381 * @ssid: source security identifier
382 * @tsid: target security identifier 382 * @tsid: target security identifier
383 * @tclass: target security class 383 * @tclass: target security class
384 * @requested: requested permissions, interpreted based on @tclass
385 * 384 *
386 * Look up an AVC entry that is valid for the 385 * Look up an AVC entry that is valid for the
387 * @requested permissions between the SID pair
388 * (@ssid, @tsid), interpreting the permissions 386 * (@ssid, @tsid), interpreting the permissions
389 * based on @tclass. If a valid AVC entry exists, 387 * based on @tclass. If a valid AVC entry exists,
390 * then this function return the avc_node. 388 * then this function return the avc_node.
391 * Otherwise, this function returns NULL. 389 * Otherwise, this function returns NULL.
392 */ 390 */
393static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass, u32 requested) 391static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass)
394{ 392{
395 struct avc_node *node; 393 struct avc_node *node;
396 394
397 avc_cache_stats_incr(lookups); 395 avc_cache_stats_incr(lookups);
398 node = avc_search_node(ssid, tsid, tclass); 396 node = avc_search_node(ssid, tsid, tclass);
399 397
400 if (node && ((node->ae.avd.decided & requested) == requested)) { 398 if (node)
401 avc_cache_stats_incr(hits); 399 avc_cache_stats_incr(hits);
402 goto out; 400 else
403 } 401 avc_cache_stats_incr(misses);
404 402
405 node = NULL;
406 avc_cache_stats_incr(misses);
407out:
408 return node; 403 return node;
409} 404}
410 405
@@ -875,7 +870,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
875 870
876 rcu_read_lock(); 871 rcu_read_lock();
877 872
878 node = avc_lookup(ssid, tsid, tclass, requested); 873 node = avc_lookup(ssid, tsid, tclass);
879 if (!node) { 874 if (!node) {
880 rcu_read_unlock(); 875 rcu_read_unlock();
881 876