Re: [PATCH v10 2/4] LoongArch: Add kprobe support

From: Tiezhu Yang
Date: Fri Dec 16 2022 - 04:33:18 EST




On 12/14/2022 03:28 PM, Masami Hiramatsu (Google) wrote:
Hi,

On Fri, 9 Dec 2022 16:52:59 +0800
Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:

Kprobes allows you to trap at almost any kernel address and
execute a callback function, this commit adds kprobe support
for LoongArch.

...

+ case KPROBE_HIT_ACTIVE:
+ case KPROBE_HIT_SSDONE:

Recently, I removed these cases because this page fault will be finally
handled by the generic pagefault handler.


Hi Masami,

I have addressed all your comments on my local machine, the code logic
looks much more clear now, thank you very much.

When I test kprobe_example.ko with a C function like "kernel_clone",
it works well, but the kernel hangs [1] when test with an assembler
function like "__memset_fast" [2].

Just did some quick research and it seems the bug is related with
kallsyms_lookup_name(), I'm looking for a solution.

[1] https://lore.kernel.org/loongarch/CAEr6+EC2wPAtK8zb3=e1mUiya3gv0UhqF9J_ySYx9p_96pB+tg@xxxxxxxxxxxxxx/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git/tree/arch/loongarch/lib/memset.S?h=loongarch-next#n56

Thanks,
Tiezhu