[PATCH 1/3] ARM: kprobes: Count MAX_OPTINSN_SIZE in kprobe_opcode_t
From: Masami Hiramatsu
Date: Thu Jan 13 2022 - 09:55:44 EST
Count the MAX_OPTINSN_SIZE in 'kprobe_opcode_t' instead
of in byte. On arm, the sizeof(kprobe_opcode_t) is u32,
thus the current code consumes 4 times larger memory for
trampoline buffer.
Fixes: 0dc016dbd820 ("ARM: kprobes: enable OPTPROBES for ARM 32")
Reported-by: Jianhua Liu <jianhua.ljh@xxxxxxxxx>
Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
---
arch/arm/include/asm/kprobes.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index e26a278d301a..092263a89102 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -56,8 +56,7 @@ extern __visible kprobe_opcode_t optprobe_template_restore_end[];
#define MAX_OPTIMIZED_LENGTH 4
#define MAX_OPTINSN_SIZE \
- ((unsigned long)optprobe_template_end - \
- (unsigned long)optprobe_template_entry)
+ (unsigned long)(optprobe_template_end - optprobe_template_entry)
#define RELATIVEJUMP_SIZE 4
struct arch_optimized_insn {