kprobe_example.c (ee037040f808848bf7355edd081d33bdb1cfd011) kprobe_example.c (6970613b4c6a86501c1faa5a86dafa40e97b794e)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Here's a sample kernel module showing the use of kprobes to dump a
4 * stack trace and selected registers when kernel_clone() is called.
5 *
6 * For more information on theory of operation of kprobes, see
7 * Documentation/trace/kprobes.rst
8 *

--- 29 unchanged lines hidden (view full) ---

38 pr_info("<%s> pre_handler: p->addr = 0x%p, epc = 0x%lx, status = 0x%lx\n",
39 p->symbol_name, p->addr, regs->cp0_epc, regs->cp0_status);
40#endif
41#ifdef CONFIG_ARM64
42 pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx,"
43 " pstate = 0x%lx\n",
44 p->symbol_name, p->addr, (long)regs->pc, (long)regs->pstate);
45#endif
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Here's a sample kernel module showing the use of kprobes to dump a
4 * stack trace and selected registers when kernel_clone() is called.
5 *
6 * For more information on theory of operation of kprobes, see
7 * Documentation/trace/kprobes.rst
8 *

--- 29 unchanged lines hidden (view full) ---

38 pr_info("<%s> pre_handler: p->addr = 0x%p, epc = 0x%lx, status = 0x%lx\n",
39 p->symbol_name, p->addr, regs->cp0_epc, regs->cp0_status);
40#endif
41#ifdef CONFIG_ARM64
42 pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx,"
43 " pstate = 0x%lx\n",
44 p->symbol_name, p->addr, (long)regs->pc, (long)regs->pstate);
45#endif
46#ifdef CONFIG_ARM
47 pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, cpsr = 0x%lx\n",
48 p->symbol_name, p->addr, (long)regs->ARM_pc, (long)regs->ARM_cpsr);
49#endif
46#ifdef CONFIG_S390
47 pr_info("<%s> pre_handler: p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n",
48 p->symbol_name, p->addr, regs->psw.addr, regs->flags);
49#endif
50
51 /* A dump_stack() here will give a stack backtrace */
52 return 0;
53}

--- 13 unchanged lines hidden (view full) ---

67#ifdef CONFIG_MIPS
68 pr_info("<%s> post_handler: p->addr = 0x%p, status = 0x%lx\n",
69 p->symbol_name, p->addr, regs->cp0_status);
70#endif
71#ifdef CONFIG_ARM64
72 pr_info("<%s> post_handler: p->addr = 0x%p, pstate = 0x%lx\n",
73 p->symbol_name, p->addr, (long)regs->pstate);
74#endif
50#ifdef CONFIG_S390
51 pr_info("<%s> pre_handler: p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n",
52 p->symbol_name, p->addr, regs->psw.addr, regs->flags);
53#endif
54
55 /* A dump_stack() here will give a stack backtrace */
56 return 0;
57}

--- 13 unchanged lines hidden (view full) ---

71#ifdef CONFIG_MIPS
72 pr_info("<%s> post_handler: p->addr = 0x%p, status = 0x%lx\n",
73 p->symbol_name, p->addr, regs->cp0_status);
74#endif
75#ifdef CONFIG_ARM64
76 pr_info("<%s> post_handler: p->addr = 0x%p, pstate = 0x%lx\n",
77 p->symbol_name, p->addr, (long)regs->pstate);
78#endif
79#ifdef CONFIG_ARM
80 pr_info("<%s> post_handler: p->addr = 0x%p, cpsr = 0x%lx\n",
81 p->symbol_name, p->addr, (long)regs->ARM_cpsr);
82#endif
75#ifdef CONFIG_S390
76 pr_info("<%s> pre_handler: p->addr, 0x%p, flags = 0x%lx\n",
77 p->symbol_name, p->addr, regs->flags);
78#endif
79}
80
81/*
82 * fault_handler: this is called if an exception is generated for any

--- 37 unchanged lines hidden ---
83#ifdef CONFIG_S390
84 pr_info("<%s> pre_handler: p->addr, 0x%p, flags = 0x%lx\n",
85 p->symbol_name, p->addr, regs->flags);
86#endif
87}
88
89/*
90 * fault_handler: this is called if an exception is generated for any

--- 37 unchanged lines hidden ---