From ee037040f808848bf7355edd081d33bdb1cfd011 Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Mon, 28 Dec 2020 07:04:15 +0100 Subject: samples/kprobes: Remove misleading comment The example file supports many architectures not only x86 and PPC. Signed-off-by: Marc Koderer Cc: trivial@kernel.org Link: https://lore.kernel.org/r/20201228060415.2194-1-marc@koderer.com Signed-off-by: Jonathan Corbet --- samples/kprobes/kprobe_example.c | 1 - 1 file changed, 1 deletion(-) (limited to 'samples') diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c index 365905cb24b1..192aa68db0c0 100644 --- a/samples/kprobes/kprobe_example.c +++ b/samples/kprobes/kprobe_example.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * NOTE: This example is works on x86 and powerpc. * Here's a sample kernel module showing the use of kprobes to dump a * stack trace and selected registers when kernel_clone() is called. * -- cgit v1.2.3-59-g8ed1b From 6970613b4c6a86501c1faa5a86dafa40e97b794e Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Tue, 12 Jan 2021 16:40:54 +0100 Subject: samples/kprobes: Add ARM support Plenty of architectures are already supported and this adds ARM support. Signed-off-by: Marc Koderer Acked-by: Masami Hiramatsu Link: https://lore.kernel.org/r/20210112154054.17138-1-marc@koderer.com Signed-off-by: Jonathan Corbet --- samples/kprobes/kprobe_example.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'samples') diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c index 192aa68db0c0..331dcf151532 100644 --- a/samples/kprobes/kprobe_example.c +++ b/samples/kprobes/kprobe_example.c @@ -43,6 +43,10 @@ static int __kprobes handler_pre(struct kprobe *p, struct pt_regs *regs) " pstate = 0x%lx\n", p->symbol_name, p->addr, (long)regs->pc, (long)regs->pstate); #endif +#ifdef CONFIG_ARM + pr_info("<%s> pre_handler: p->addr = 0x%p, pc = 0x%lx, cpsr = 0x%lx\n", + p->symbol_name, p->addr, (long)regs->ARM_pc, (long)regs->ARM_cpsr); +#endif #ifdef CONFIG_S390 pr_info("<%s> pre_handler: p->addr, 0x%p, ip = 0x%lx, flags = 0x%lx\n", p->symbol_name, p->addr, regs->psw.addr, regs->flags); @@ -72,6 +76,10 @@ static void __kprobes handler_post(struct kprobe *p, struct pt_regs *regs, pr_info("<%s> post_handler: p->addr = 0x%p, pstate = 0x%lx\n", p->symbol_name, p->addr, (long)regs->pstate); #endif +#ifdef CONFIG_ARM + pr_info("<%s> post_handler: p->addr = 0x%p, cpsr = 0x%lx\n", + p->symbol_name, p->addr, (long)regs->ARM_cpsr); +#endif #ifdef CONFIG_S390 pr_info("<%s> pre_handler: p->addr, 0x%p, flags = 0x%lx\n", p->symbol_name, p->addr, regs->flags); -- cgit v1.2.3-59-g8ed1b