diff options
author | Stephen Smalley <stephen.smalley.work@gmail.com> | 2020-08-19 22:45:16 +0300 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2020-08-25 15:34:47 +0300 |
commit | 1b8b31a2e6120b7b2bc99137c0ba1ae3e45dbd7d (patch) | |
tree | 7c263dfa7217f93b7b12ac5d1417d598ba874e36 /security/selinux/hooks.c | |
parent | c76a2f9ecdcb44cdcdb2de82e90d84283736aeb2 (diff) | |
download | linux-1b8b31a2e6120b7b2bc99137c0ba1ae3e45dbd7d.tar.xz |
selinux: convert policy read-write lock to RCU
Convert the policy read-write lock to RCU. This is significantly
simplified by the earlier work to encapsulate the policy data
structures and refactor the policy load and boolean setting logic.
Move the latest_granting sequence number into the selinux_policy
structure so that it can be updated atomically with the policy.
Since removing the policy rwlock and moving latest_granting reduces
the selinux_ss structure to nothing more than a wrapper around the
selinux_policy pointer, get rid of the extra layer of indirection.
At present this change merely passes a hardcoded 1 to
rcu_dereference_check() in the cases where we know we do not need to
take rcu_read_lock(), with the preceding comment explaining why.
Alternatively we could pass fsi->mutex down from selinuxfs and
apply a lockdep check on it instead.
Based in part on earlier attempts to convert the policy rwlock
to RCU by Kaigai Kohei [1] and by Peter Enderborg [2].
[1] https://lore.kernel.org/selinux/6e2f9128-e191-ebb3-0e87-74bfccb0767f@tycho.nsa.gov/
[2] https://lore.kernel.org/selinux/20180530141104.28569-1-peter.enderborg@sony.com/
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e3fe5647a366..6f30ba1a38dc 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -7235,7 +7235,6 @@ static __init int selinux_init(void) memset(&selinux_state, 0, sizeof(selinux_state)); enforcing_set(&selinux_state, selinux_enforcing_boot); selinux_state.checkreqprot = selinux_checkreqprot_boot; - selinux_ss_init(&selinux_state.ss); selinux_avc_init(&selinux_state.avc); mutex_init(&selinux_state.status_lock); |