summaryrefslogtreecommitdiff
path: root/kernel/bpf/bpf_insn_array.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/bpf_insn_array.c')
-rw-r--r--kernel/bpf/bpf_insn_array.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/bpf/bpf_insn_array.c b/kernel/bpf/bpf_insn_array.c
index 61ce52882632..c96630cb75bf 100644
--- a/kernel/bpf/bpf_insn_array.c
+++ b/kernel/bpf/bpf_insn_array.c
@@ -55,6 +55,9 @@ static struct bpf_map *insn_array_alloc(union bpf_attr *attr)
bpf_map_init_from_attr(&insn_array->map, attr);
+ /* BPF programs aren't allowed to write to the map */
+ insn_array->map.map_flags |= BPF_F_RDONLY_PROG;
+
return &insn_array->map;
}