ftrace.c (773c16705058e9be7b0f4ce124e89cd231c120a2) ftrace.c (d19ad0775dcd64b49eecf4fa79c17959ebfbd26b)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/kprobes.h>
4
5int arch_check_ftrace_location(struct kprobe *p)
6{
7 if (ftrace_location((unsigned long)p->addr))
8 p->flags |= KPROBE_FLAG_FTRACE;
9 return 0;
10}
11
12/* Ftrace callback handler for kprobes -- called under preepmt disabed */
13void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/kprobes.h>
4
5int arch_check_ftrace_location(struct kprobe *p)
6{
7 if (ftrace_location((unsigned long)p->addr))
8 p->flags |= KPROBE_FLAG_FTRACE;
9 return 0;
10}
11
12/* Ftrace callback handler for kprobes -- called under preepmt disabed */
13void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
14 struct ftrace_ops *ops, struct pt_regs *regs)
14 struct ftrace_ops *ops, struct ftrace_regs *fregs)
15{
16 int bit;
17 bool lr_saver = false;
18 struct kprobe *p;
19 struct kprobe_ctlblk *kcb;
15{
16 int bit;
17 bool lr_saver = false;
18 struct kprobe *p;
19 struct kprobe_ctlblk *kcb;
20 struct pt_regs *regs;
20
21 bit = ftrace_test_recursion_trylock(ip, parent_ip);
22 if (bit < 0)
23 return;
24
21
22 bit = ftrace_test_recursion_trylock(ip, parent_ip);
23 if (bit < 0)
24 return;
25
26 regs = ftrace_get_regs(fregs);
25 preempt_disable_notrace();
26 p = get_kprobe((kprobe_opcode_t *)ip);
27 if (!p) {
28 p = get_kprobe((kprobe_opcode_t *)(ip - MCOUNT_INSN_SIZE));
29 if (unlikely(!p) || kprobe_disabled(p))
30 goto out;
31 lr_saver = true;
32 }

--- 42 unchanged lines hidden ---
27 preempt_disable_notrace();
28 p = get_kprobe((kprobe_opcode_t *)ip);
29 if (!p) {
30 p = get_kprobe((kprobe_opcode_t *)(ip - MCOUNT_INSN_SIZE));
31 if (unlikely(!p) || kprobe_disabled(p))
32 goto out;
33 lr_saver = true;
34 }

--- 42 unchanged lines hidden ---