bpf: Remove arch_unprotect_bpf_trampoline()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Sat, 16 Mar 2024 07:35:40 +0000 (08:35 +0100)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 18 Mar 2024 21:18:47 +0000 (14:18 -0700)
Last user of arch_unprotect_bpf_trampoline() was removed by
commit 187e2af05abe ("bpf: struct_ops supports more than one page for
trampolines.")

Remove arch_unprotect_bpf_trampoline()

Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Fixes: 187e2af05abe ("bpf: struct_ops supports more than one page for trampolines.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/42c635bb54d3af91db0f9b85d724c7c290069f67.1710574353.git.christophe.leroy@csgroup.eu
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
arch/arm64/net/bpf_jit_comp.c
arch/x86/net/bpf_jit_comp.c
include/linux/bpf.h
kernel/bpf/trampoline.c

index c5b461dda4385960437d5472cc3e3945d7f9a3fe..132c8ffba10962bb97ca8a7ef6685722b9a2a8d6 100644 (file)
@@ -2180,10 +2180,6 @@ void arch_protect_bpf_trampoline(void *image, unsigned int size)
 {
 }
 
-void arch_unprotect_bpf_trampoline(void *image, unsigned int size)
-{
-}
-
 int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,
                                void *ro_image_end, const struct btf_func_model *m,
                                u32 flags, struct bpf_tramp_links *tlinks,
index a7ba8e1786452db2442eaeeee8d3996c19f3e3b6..7a56d2d845120b1eca0ce7c88ed1d0918c49e2cb 100644 (file)
@@ -3008,10 +3008,6 @@ void arch_protect_bpf_trampoline(void *image, unsigned int size)
 {
 }
 
-void arch_unprotect_bpf_trampoline(void *image, unsigned int size)
-{
-}
-
 int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
                                const struct btf_func_model *m, u32 flags,
                                struct bpf_tramp_links *tlinks,
index 4f20f62f9d63da87800af4ac21cbc7c92dae5fb9..d89bdefb42e2ff3fe77fc20634b00f2dcd478cb6 100644 (file)
@@ -1117,7 +1117,6 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i
 void *arch_alloc_bpf_trampoline(unsigned int size);
 void arch_free_bpf_trampoline(void *image, unsigned int size);
 void arch_protect_bpf_trampoline(void *image, unsigned int size);
-void arch_unprotect_bpf_trampoline(void *image, unsigned int size);
 int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
                             struct bpf_tramp_links *tlinks, void *func_addr);
 
index db7599c59c78a66f1b85ef969ba64be084edd181..04fd1abd36612cf74f8745f4f2ad7237273947d9 100644 (file)
@@ -1078,13 +1078,6 @@ void __weak arch_protect_bpf_trampoline(void *image, unsigned int size)
        set_memory_rox((long)image, 1);
 }
 
-void __weak arch_unprotect_bpf_trampoline(void *image, unsigned int size)
-{
-       WARN_ON_ONCE(size > PAGE_SIZE);
-       set_memory_nx((long)image, 1);
-       set_memory_rw((long)image, 1);
-}
-
 int __weak arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
                                    struct bpf_tramp_links *tlinks, void *func_addr)
 {