Thread (18 messages) 18 messages, 3 authors, 2021-04-12
STALE1873d
Revisions (2)
  1. v2 current
  2. v3 [diff vs current]

[PATCH v2 6/9] riscv: bpf: Write protect JIT code

From: Jisheng Zhang <hidden>
Date: 2021-03-31 16:33:58
Also in: linux-riscv, lkml, netdev
Subsystem: bpf jit for risc-v (32-bit), bpf jit for risc-v (64-bit), bpf [general] (safe dynamic programs and tools), risc-v architecture, the rest · Maintainers: Luke Nelson, Xi Wang, Björn Töpel, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, Paul Walmsley, Palmer Dabbelt, Albert Ou, Linus Torvalds

From: Jisheng Zhang <jszhang@kernel.org>

Call bpf_jit_binary_lock_ro() to write protect JIT code.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/net/bpf_jit_core.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c
index 3630d447352c..40d5bf113fee 100644
--- a/arch/riscv/net/bpf_jit_core.c
+++ b/arch/riscv/net/bpf_jit_core.c
@@ -152,6 +152,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 	bpf_flush_icache(jit_data->header, ctx->insns + ctx->ninsns);
 
 	if (!prog->is_func || extra_pass) {
+		bpf_jit_binary_lock_ro(jit_data->header);
 out_offset:
 		kfree(ctx->offset);
 		kfree(jit_data);
-- 
2.31.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help