selinux: mark some global variables __ro_after_init
authorOndrej Mosnacek <omosnace@redhat.com>
Wed, 6 Jan 2021 13:26:21 +0000 (14:26 +0100)
committerPaul Moore <paul@paul-moore.com>
Tue, 12 Jan 2021 15:08:55 +0000 (10:08 -0500)
All of these are never modified outside initcalls, so they can be
__ro_after_init.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/avc.c
security/selinux/netlink.c
security/selinux/selinuxfs.c
security/selinux/ss/avtab.c
security/selinux/ss/ebitmap.c
security/selinux/ss/hashtab.c

index 3c05827608b6a8d5ccf3ec480047e2e5b8200bbf..ad451cf9375e44f66769a9659293416f18a84a50 100644 (file)
@@ -118,11 +118,11 @@ void avc_set_cache_threshold(struct selinux_avc *avc,
        avc->avc_cache_threshold = cache_threshold;
 }
 
-static struct avc_callback_node *avc_callbacks;
-static struct kmem_cache *avc_node_cachep;
-static struct kmem_cache *avc_xperms_data_cachep;
-static struct kmem_cache *avc_xperms_decision_cachep;
-static struct kmem_cache *avc_xperms_cachep;
+static struct avc_callback_node *avc_callbacks __ro_after_init;
+static struct kmem_cache *avc_node_cachep __ro_after_init;
+static struct kmem_cache *avc_xperms_data_cachep __ro_after_init;
+static struct kmem_cache *avc_xperms_decision_cachep __ro_after_init;
+static struct kmem_cache *avc_xperms_cachep __ro_after_init;
 
 static inline int avc_hash(u32 ssid, u32 tsid, u16 tclass)
 {
index 621e2e9cd6a1d70595f8f303b519f2e68d37e7dd..1760aee712fd2ef4ed805d6f0a9edffedd547e58 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "security.h"
 
-static struct sock *selnl;
+static struct sock *selnl __ro_after_init;
 
 static int selnl_msglen(int msgtype)
 {
index 4fdfe7b67df89be486246b895efba452e3a9347f..01a7d50ed39b8a29c96259b4bf2b123387c6877b 100644 (file)
@@ -2204,8 +2204,8 @@ static struct file_system_type sel_fs_type = {
        .kill_sb        = sel_kill_sb,
 };
 
-static struct vfsmount *selinuxfs_mount;
-struct path selinux_null;
+static struct vfsmount *selinuxfs_mount __ro_after_init;
+struct path selinux_null __ro_after_init;
 
 static int __init init_sel_fs(void)
 {
index 0172d87e2b9aebeab88f455694b17eacef15e92f..6dcb6aa4db7f0d51bcd525b3defed6324a3f67bf 100644 (file)
@@ -23,8 +23,8 @@
 #include "avtab.h"
 #include "policydb.h"
 
-static struct kmem_cache *avtab_node_cachep;
-static struct kmem_cache *avtab_xperms_cachep;
+static struct kmem_cache *avtab_node_cachep __ro_after_init;
+static struct kmem_cache *avtab_xperms_cachep __ro_after_init;
 
 /* Based on MurmurHash3, written by Austin Appleby and placed in the
  * public domain.
index 14bedc95c6dcf0c14261a3ea5c2351510f4158ca..61fcbb8d0f8808525d7cb87e10e53915c726544d 100644 (file)
@@ -26,7 +26,7 @@
 
 #define BITS_PER_U64   (sizeof(u64) * 8)
 
-static struct kmem_cache *ebitmap_node_cachep;
+static struct kmem_cache *ebitmap_node_cachep __ro_after_init;
 
 int ebitmap_cmp(struct ebitmap *e1, struct ebitmap *e2)
 {
index dab8c25c739b91e082156a5a47a73a852786b105..3881787ce492c6693efa55dd20ee6c49204d3037 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/errno.h>
 #include "hashtab.h"
 
-static struct kmem_cache *hashtab_node_cachep;
+static struct kmem_cache *hashtab_node_cachep __ro_after_init;
 
 /*
  * Here we simply round the number of elements up to the nearest power of two.