-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: rethook: Replace kretprobe trampoline with rethook
Replace the kretprobe's trampoline code with the rethook on arm64. The rethook on arm64 is almost renamed from kretprobe trampoline code. The mechanism is completely same. Signed-off-by: Masami Hiramatsu <[email protected]>
- Loading branch information
Showing
9 changed files
with
41 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
obj-$(CONFIG_KPROBES) += kprobes.o decode-insn.o \ | ||
kprobes_trampoline.o \ | ||
simulate-insn.o | ||
obj-$(CONFIG_UPROBES) += uprobes.o decode-insn.o \ | ||
simulate-insn.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Generic return hook for arm64. | ||
* Most of the code is copied from arch/arm64/kernel/probes/kprobes.c | ||
*/ | ||
|
||
#include <linux/kprobes.h> | ||
#include <linux/rethook.h> | ||
|
||
/* This is called from arch_rethook_trampoline() */ | ||
unsigned long __used arch_rethook_trampoline_callback(struct pt_regs *regs); | ||
|
||
unsigned long __used arch_rethook_trampoline_callback(struct pt_regs *regs) | ||
{ | ||
return rethook_trampoline_handler(regs, regs->regs[29]); | ||
} | ||
NOKPROBE_SYMBOL(arch_rethook_trampoline_callback); | ||
|
||
int arch_rethook_prepare(struct rethook_node *rhn, struct pt_regs *regs, bool mcount) | ||
{ | ||
rhn->ret_addr = regs->regs[30]; | ||
rhn->frame = regs->regs[29]; | ||
|
||
/* replace return addr (x30) with trampoline */ | ||
regs->regs[30] = (u64)arch_rethook_trampoline; | ||
return 0; | ||
} | ||
NOKPROBE_SYMBOL(arch_rethook_prepare); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters