From cad539baa48ff257b598000a90db2b7edd4b2dd5 Mon Sep 17 00:00:00 2001 From: Puranjay Mohan Date: Thu, 31 Aug 2023 13:12:28 +0000 Subject: riscv: implement a memset like function for text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BPF JIT needs to write invalid instructions to RX regions of memory to invalidate removed BPF programs. This needs a function like memset() that can work with RX memory. Implement patch_text_set_nosync() which is similar to text_poke_set() of x86. Signed-off-by: Puranjay Mohan Reviewed-by: Pu Lehui Acked-by: Björn Töpel Tested-by: Björn Töpel Acked-by: Daniel Borkmann Link: https://lore.kernel.org/r/20230831131229.497941-4-puranjay12@gmail.com Signed-off-by: Palmer Dabbelt --- arch/riscv/include/asm/patch.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/riscv/include/asm/patch.h') diff --git a/arch/riscv/include/asm/patch.h b/arch/riscv/include/asm/patch.h index 63c98833d510..e88b52d39eac 100644 --- a/arch/riscv/include/asm/patch.h +++ b/arch/riscv/include/asm/patch.h @@ -7,6 +7,7 @@ #define _ASM_RISCV_PATCH_H int patch_text_nosync(void *addr, const void *insns, size_t len); +int patch_text_set_nosync(void *addr, u8 c, size_t len); int patch_text(void *addr, u32 *insns, int ninsns); extern int riscv_patch_in_stop_machine; -- cgit v1.2.3