Re: [PATCH] livepatch: Add using attribute to klp_func for using func show
From: Miroslav Benes
Date: Fri Jul 19 2024 - 08:09:22 EST
Hi,
On Thu, 18 Jul 2024, zhangyongde.zyd wrote:
> From: Wardenjohn <zhangwarden@xxxxxxxxx>
>
> One system may contains more than one livepatch module. We can see
> which patch is enabled. If some patches applied to one system
> modifing the same function, livepatch will use the function enabled
> on top of the function stack. However, we can not excatly know
> which function of which patch is now enabling.
>
> This patch introduce one sysfs attribute of "using" to klp_func.
> For example, if there are serval patches make changes to function
> "meminfo_proc_show", the attribute "enabled" of all the patch is 1.
> With this attribute, we can easily know the version enabling belongs
> to which patch.
>
> cat /sys/kernel/livepatch/<patch1>/<object1>/<function1,sympos>/using -> 0
> means that the function1 of patch1 is disabled.
>
> cat /sys/kernel/livepatch/<patchN>/<object1>/<function1,sympos>/using -> 1
> means that the function1 of patchN is enabled.
is this always correct though? See the logic in klp_ftrace_handler(). If
there is a transition running, it is a little bit more complicated.
Miroslav