Re: [PATCH RFC] MIPS: livepatch: Add LIVEPATCH basic code

From: Jinyang He
Date: Wed Mar 10 2021 - 03:57:22 EST


On 03/10/2021 04:18 PM, Miroslav Benes wrote:

Hi,

I cannot really comment on mips arch specifics but few words from the live
patching perspective.
Thanks for your reply. :-)


On Mon, 1 Mar 2021, Jinyang He wrote:

Add the basic code of livepatch. livepatch is temporarily unavailable.
Two core functions are missing, one is DYNAMIC_FTRACE_WITH_REGS, and
another is save_stack_trace_tsk_reliable().
`Huang Pei <huangpei@xxxxxxxxxxx>` is doing for ftrace. He will use
`-fpatchable-function-entry` to achieve more complete ftrace.
DYNAMIC_FTRACE_WITH_ARGS has been introduced recently, so you might also
look at that. As far as the live patching is concerned,
DYNAMIC_FTRACE_WITH_ARGS is sufficient.
Huang Pei had told me, and the follow link explains it detaily.
He is doing this work on mips arch now.

http://mpe.github.io/posts/2016/05/23/kernel-live-patching-for-ppc64le/

save_stack_trace_tsk_reliable() currently has difficulties. This function
may be improved in the future, but that seems to be a long time away.
This is also the reason for delivering this RFC. Hope to get any help.
You may want to look at Documentation/livepatch/reliable-stacktrace.rst
which nicely describes the requirements for the reliable stacktraces.
And Maciej answered many questions for me about reliable stacktrace.
I thought Documentation/livepatch/reliable-stacktrace.rst is important, too.
I noticed that arm64 has submitted objtool patches before, and it seems that
MIPS may use this method (ORC) to achieve reliable stack traceback. It looks
complicated to me. Drawf, compiler, abi and so on.

Regards
Miroslav
Thanks,
Jinyang