aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorDaniel Jurgens <danielj@mellanox.com>2017-05-19 08:48:53 -0400
committerPaul Moore <paul@paul-moore.com>2017-05-23 12:27:11 -0400
commit8f408ab64be6319cb7736cbc6982838dcc362306 (patch)
treefa7169e96ad81ac38d6d78ac03668196dde902c4 /security/selinux/hooks.c
parentd291f1a6523292d916fe1659c67f6db061fbd1b5 (diff)
selinux lsm IB/core: Implement LSM notification system
Add a generic notificaiton mechanism in the LSM. Interested consumers can register a callback with the LSM and security modules can produce events. Because access to Infiniband QPs are enforced in the setup phase of a connection security should be enforced again if the policy changes. Register infiniband devices for policy change notification and check all QPs on that device when the notification is received. Add a call to the notification mechanism from SELinux when the AVC cache changes or setenforce is cleared. Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Acked-by: James Morris <james.l.morris@oracle.com> Acked-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cfb7ce339adc..b005acbcc6e9 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -171,6 +171,14 @@ static int selinux_netcache_avc_callback(u32 event)
171 return 0; 171 return 0;
172} 172}
173 173
174static int selinux_lsm_notifier_avc_callback(u32 event)
175{
176 if (event == AVC_CALLBACK_RESET)
177 call_lsm_notifier(LSM_POLICY_CHANGE, NULL);
178
179 return 0;
180}
181
174/* 182/*
175 * initialise the security for the init task 183 * initialise the security for the init task
176 */ 184 */
@@ -6387,6 +6395,9 @@ static __init int selinux_init(void)
6387 if (avc_add_callback(selinux_netcache_avc_callback, AVC_CALLBACK_RESET)) 6395 if (avc_add_callback(selinux_netcache_avc_callback, AVC_CALLBACK_RESET))
6388 panic("SELinux: Unable to register AVC netcache callback\n"); 6396 panic("SELinux: Unable to register AVC netcache callback\n");
6389 6397
6398 if (avc_add_callback(selinux_lsm_notifier_avc_callback, AVC_CALLBACK_RESET))
6399 panic("SELinux: Unable to register AVC LSM notifier callback\n");
6400
6390 if (selinux_enforcing) 6401 if (selinux_enforcing)
6391 printk(KERN_DEBUG "SELinux: Starting in enforcing mode\n"); 6402 printk(KERN_DEBUG "SELinux: Starting in enforcing mode\n");
6392 else 6403 else