diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-03-26 16:12:00 +0100 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-03-31 16:20:22 +0200 |
commit | 52fa82c21f64e900a72437269a5cc9e0034b424e (patch) | |
tree | b2a122854db8fa1ed6adc80be5e5dee1dc3ab22f /arch/x86/kernel/kprobes | |
parent | 2304d14db6595bea5292bece06c4c625b12d8f89 (diff) | |
download | linux-52fa82c21f64e900a72437269a5cc9e0034b424e.tar.gz linux-52fa82c21f64e900a72437269a5cc9e0034b424e.tar.bz2 linux-52fa82c21f64e900a72437269a5cc9e0034b424e.zip |
x86: Add insn_decode_kernel()
Add a helper to decode kernel instructions; there's no point in
endlessly repeating those last two arguments.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210326151259.379242587@infradead.org
Diffstat (limited to 'arch/x86/kernel/kprobes')
-rw-r--r-- | arch/x86/kernel/kprobes/core.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/kprobes/opt.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index dd0902184708..1319ff47c85c 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -285,7 +285,7 @@ static int can_probe(unsigned long paddr) if (!__addr) return 0; - ret = insn_decode(&insn, (void *)__addr, MAX_INSN_SIZE, INSN_MODE_KERN); + ret = insn_decode_kernel(&insn, (void *)__addr); if (ret < 0) return 0; @@ -322,7 +322,7 @@ int __copy_instruction(u8 *dest, u8 *src, u8 *real, struct insn *insn) MAX_INSN_SIZE)) return 0; - ret = insn_decode(insn, dest, MAX_INSN_SIZE, INSN_MODE_KERN); + ret = insn_decode_kernel(insn, dest); if (ret < 0) return 0; diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 4299fc865732..71425ebba98a 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -324,7 +324,7 @@ static int can_optimize(unsigned long paddr) if (!recovered_insn) return 0; - ret = insn_decode(&insn, (void *)recovered_insn, MAX_INSN_SIZE, INSN_MODE_KERN); + ret = insn_decode_kernel(&insn, (void *)recovered_insn); if (ret < 0) return 0; |