Re: [PATCH 2/2] MIPS: Use NOKPROBE_SYMBOL() instead of __kprobes annotation

From: Tiezhu Yang
Date: Thu May 05 2022 - 23:24:20 EST




On 05/06/2022 09:45 AM, Masami Hiramatsu wrote:
On Thu, 5 May 2022 20:19:08 +0800
Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:

If define CONFIG_KPROBES, __kprobes annotation forces the whole function
into the ".kprobes.text" section, NOKPROBE_SYMBOL() just stores the given
function address in the "_kprobe_blacklist" section which is introduced
to maintain kprobes blacklist.

Modify the related code to use NOKPROBE_SYMBOL() to protect functions from
kprobes instead of __kprobes annotation under arch/mips.

So you added some non '__kprobes' annotated functions to NOKPROBE_SYMBOL()
in this patch. Those caused the kernel panic, right?

Oh, no, this patch is not related with the kernel panic, what it does
is just to use NOKPROBE_SYMBOL() instead of __kprobes annotation, and
also add some non '__kprobes' annotated functions in kprobes.c to
NOKPROBE_SYMBOL() because they can not be probed too.

If so, please add such
comment on this description too. Or, split this into 2 patches, one fixes
the kernel panic by adding those functions to NOKPROBE_SYMBOL() and the
other is replacing __kprobes with NOKPROBE_SYMBOL().

Also, could you also find the commit which introduces the kernel panic?
It is worth to backport such fix to stable trees.

I did some work to find some other functions lead to kernel panic,
mark them as notrace function can avoid the problems, but I am not
quite sure the root cause, so I do not submit the changes now.

Thanks,
Tiezhu