Messages in this thread Patch in this message | | | From | Masami Hiramatsu <> | Subject | [PATCH 1/3] ARM: kprobes: Count MAX_OPTINSN_SIZE in kprobe_opcode_t | Date | Thu, 13 Jan 2022 23:55:37 +0900 |
| |
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@gmail.com> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> --- 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 {
| |