aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/arraymap.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2017-02-16 16:24:48 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-17 13:40:04 -0500
commitc78f8bdfa11fcceb9723c61212e4bd8f76c87f9e (patch)
tree456eca6a892aea9e8cd9fec3b9ca6b380112d7b2 /kernel/bpf/arraymap.c
parentafcb50ba7f745eea32f91d7f63d6aa88f929f9c4 (diff)
bpf: mark all registered map/prog types as __ro_after_init
All map types and prog types are registered to the BPF core through bpf_register_map_type() and bpf_register_prog_type() during init and remain unchanged thereafter. As by design we don't (and never will) have any pluggable code that can register to that at any later point in time, lets mark all the existing bpf_{map,prog}_type_list objects in the tree as __ro_after_init, so they can be moved to read-only section from then onwards. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/arraymap.c')
-rw-r--r--kernel/bpf/arraymap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 3d55d95dcf49..6b6f41f0b211 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -269,7 +269,7 @@ static const struct bpf_map_ops array_ops = {
269 .map_delete_elem = array_map_delete_elem, 269 .map_delete_elem = array_map_delete_elem,
270}; 270};
271 271
272static struct bpf_map_type_list array_type __read_mostly = { 272static struct bpf_map_type_list array_type __ro_after_init = {
273 .ops = &array_ops, 273 .ops = &array_ops,
274 .type = BPF_MAP_TYPE_ARRAY, 274 .type = BPF_MAP_TYPE_ARRAY,
275}; 275};
@@ -283,7 +283,7 @@ static const struct bpf_map_ops percpu_array_ops = {
283 .map_delete_elem = array_map_delete_elem, 283 .map_delete_elem = array_map_delete_elem,
284}; 284};
285 285
286static struct bpf_map_type_list percpu_array_type __read_mostly = { 286static struct bpf_map_type_list percpu_array_type __ro_after_init = {
287 .ops = &percpu_array_ops, 287 .ops = &percpu_array_ops,
288 .type = BPF_MAP_TYPE_PERCPU_ARRAY, 288 .type = BPF_MAP_TYPE_PERCPU_ARRAY,
289}; 289};
@@ -409,7 +409,7 @@ static const struct bpf_map_ops prog_array_ops = {
409 .map_fd_put_ptr = prog_fd_array_put_ptr, 409 .map_fd_put_ptr = prog_fd_array_put_ptr,
410}; 410};
411 411
412static struct bpf_map_type_list prog_array_type __read_mostly = { 412static struct bpf_map_type_list prog_array_type __ro_after_init = {
413 .ops = &prog_array_ops, 413 .ops = &prog_array_ops,
414 .type = BPF_MAP_TYPE_PROG_ARRAY, 414 .type = BPF_MAP_TYPE_PROG_ARRAY,
415}; 415};
@@ -522,7 +522,7 @@ static const struct bpf_map_ops perf_event_array_ops = {
522 .map_release = perf_event_fd_array_release, 522 .map_release = perf_event_fd_array_release,
523}; 523};
524 524
525static struct bpf_map_type_list perf_event_array_type __read_mostly = { 525static struct bpf_map_type_list perf_event_array_type __ro_after_init = {
526 .ops = &perf_event_array_ops, 526 .ops = &perf_event_array_ops,
527 .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, 527 .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
528}; 528};
@@ -564,7 +564,7 @@ static const struct bpf_map_ops cgroup_array_ops = {
564 .map_fd_put_ptr = cgroup_fd_array_put_ptr, 564 .map_fd_put_ptr = cgroup_fd_array_put_ptr,
565}; 565};
566 566
567static struct bpf_map_type_list cgroup_array_type __read_mostly = { 567static struct bpf_map_type_list cgroup_array_type __ro_after_init = {
568 .ops = &cgroup_array_ops, 568 .ops = &cgroup_array_ops,
569 .type = BPF_MAP_TYPE_CGROUP_ARRAY, 569 .type = BPF_MAP_TYPE_CGROUP_ARRAY,
570}; 570};