aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
commit8b3f6af86378d0a10ca2f1ded1da124aef13b62c (patch)
treede6ca90295730343c495be8d98be8efa322140ef /security/selinux
parent139d6065c83071d5f66cd013a274a43699f8e2c1 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts: drivers/staging/Kconfig drivers/staging/Makefile drivers/staging/cpc-usb/TODO drivers/staging/cpc-usb/cpc-usb_drv.c drivers/staging/cpc-usb/cpc.h drivers/staging/cpc-usb/cpc_int.h drivers/staging/cpc-usb/cpcusb.h
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/avc.c41
-rw-r--r--security/selinux/exports.c6
-rw-r--r--security/selinux/hooks.c2
3 files changed, 39 insertions, 10 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index e3d19014259b..b4b5da1c0a42 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -709,18 +709,16 @@ out:
709} 709}
710 710
711/** 711/**
712 * avc_ss_reset - Flush the cache and revalidate migrated permissions. 712 * avc_flush - Flush the cache
713 * @seqno: policy sequence number
714 */ 713 */
715int avc_ss_reset(u32 seqno) 714static void avc_flush(void)
716{ 715{
717 struct avc_callback_node *c;
718 int i, rc = 0, tmprc;
719 unsigned long flag;
720 struct avc_node *node;
721 struct hlist_head *head; 716 struct hlist_head *head;
722 struct hlist_node *next; 717 struct hlist_node *next;
718 struct avc_node *node;
723 spinlock_t *lock; 719 spinlock_t *lock;
720 unsigned long flag;
721 int i;
724 722
725 for (i = 0; i < AVC_CACHE_SLOTS; i++) { 723 for (i = 0; i < AVC_CACHE_SLOTS; i++) {
726 head = &avc_cache.slots[i]; 724 head = &avc_cache.slots[i];
@@ -737,6 +735,18 @@ int avc_ss_reset(u32 seqno)
737 rcu_read_unlock(); 735 rcu_read_unlock();
738 spin_unlock_irqrestore(lock, flag); 736 spin_unlock_irqrestore(lock, flag);
739 } 737 }
738}
739
740/**
741 * avc_ss_reset - Flush the cache and revalidate migrated permissions.
742 * @seqno: policy sequence number
743 */
744int avc_ss_reset(u32 seqno)
745{
746 struct avc_callback_node *c;
747 int rc = 0, tmprc;
748
749 avc_flush();
740 750
741 for (c = avc_callbacks; c; c = c->next) { 751 for (c = avc_callbacks; c; c = c->next) {
742 if (c->events & AVC_CALLBACK_RESET) { 752 if (c->events & AVC_CALLBACK_RESET) {
@@ -858,6 +868,19 @@ u32 avc_policy_seqno(void)
858 868
859void avc_disable(void) 869void avc_disable(void)
860{ 870{
861 if (avc_node_cachep) 871 /*
862 kmem_cache_destroy(avc_node_cachep); 872 * If you are looking at this because you have realized that we are
873 * not destroying the avc_node_cachep it might be easy to fix, but
874 * I don't know the memory barrier semantics well enough to know. It's
875 * possible that some other task dereferenced security_ops when
876 * it still pointed to selinux operations. If that is the case it's
877 * possible that it is about to use the avc and is about to need the
878 * avc_node_cachep. I know I could wrap the security.c security_ops call
879 * in an rcu_lock, but seriously, it's not worth it. Instead I just flush
880 * the cache and get that memory back.
881 */
882 if (avc_node_cachep) {
883 avc_flush();
884 /* kmem_cache_destroy(avc_node_cachep); */
885 }
863} 886}
diff --git a/security/selinux/exports.c b/security/selinux/exports.c
index c73aeaa008e8..c0a454aee1e0 100644
--- a/security/selinux/exports.c
+++ b/security/selinux/exports.c
@@ -63,3 +63,9 @@ void selinux_secmark_refcount_dec(void)
63 atomic_dec(&selinux_secmark_refcount); 63 atomic_dec(&selinux_secmark_refcount);
64} 64}
65EXPORT_SYMBOL_GPL(selinux_secmark_refcount_dec); 65EXPORT_SYMBOL_GPL(selinux_secmark_refcount_dec);
66
67bool selinux_is_enabled(void)
68{
69 return selinux_enabled;
70}
71EXPORT_SYMBOL_GPL(selinux_is_enabled);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 417f7c994522..bb230d5d7085 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2411,7 +2411,7 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
2411 /* Wake up the parent if it is waiting so that it can recheck 2411 /* Wake up the parent if it is waiting so that it can recheck
2412 * wait permission to the new task SID. */ 2412 * wait permission to the new task SID. */
2413 read_lock(&tasklist_lock); 2413 read_lock(&tasklist_lock);
2414 wake_up_interruptible(&current->real_parent->signal->wait_chldexit); 2414 __wake_up_parent(current, current->real_parent);
2415 read_unlock(&tasklist_lock); 2415 read_unlock(&tasklist_lock);
2416} 2416}
2417 2417