Re: kernel hangs when kprobe memcpy

From: Tiezhu Yang
Date: Mon Jan 30 2023 - 22:40:42 EST




On 01/16/2023 02:41 PM, Masami Hiramatsu (Google) wrote:
Hi Tiezhu,

On Sat, 14 Jan 2023 14:53:21 +0800
Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:

...

If you saw that without any change, please report it. At least
memcpy is already marked as noinstr.

The current upstream mainline kernel has no problem, because it includes
commit e3a9e681adb7 ("x86/entry: Fixup bad_iret vs noinstr"), memcpy is
already marked as noinstr. But for the kernel without the above commit,
like kernel 5.7, it has problem.

I've confirmed that kernel 5.4.228 (the latest stable tree) did not have
this issue (it already rejects the memcpy).

I just tested the stable kernel 5.4.230 on x86_64 fedora 36,
without any change, kernel hangs when execute cmd:
modprobe kprobe_example symbol="memcpy"

https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.230.tar.xz

Am I missing something? Since 5.4 is a stable tree, should we do something to fix it?

Thanks,
Tiezhu