Thread (45 messages) 45 messages, 9 authors, 2020-01-31

Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-10-16 09:52:11
Also in: lkml

On Wed, Oct 16, 2019 at 11:36:10AM +0200, Jessica Yu wrote:
quoted hunk ↗ jump to hunk
+++ Peter Zijlstra [16/10/19 11:23 +0200]:
quoted
On Wed, Oct 16, 2019 at 08:51:27AM +0200, Miroslav Benes wrote:
quoted
On Tue, 15 Oct 2019, Joe Lawrence wrote:
quoted
On 10/15/19 10:13 AM, Miroslav Benes wrote:
quoted
Yes, it does. klp_module_coming() calls module_disable_ro() on all
patching modules which patch the coming module in order to call
apply_relocate_add(). New (patching) code for a module can be relocated
only when the relevant module is loaded.
FWIW, would the LPC blue-sky2 model (ie, Steve's suggestion @ plumber's where
livepatches only patch a single object and updates are kept on disk to handle
coming module updates as they are loaded) eliminate those outstanding
relocations and the need to perform this late permission flipping?
Yes, it should, but we don't have to wait for it. PeterZ proposed a
different solution to this specific issue in
https://lore.kernel.org/lkml/20191015141111.GP2359@hirez.programming.kicks-ass.net/ (local)

It should not be a problem to create a live patch module like that and the
code in kernel/livepatch/ is almost ready. Something like
module_section_disable_ro(mod, section) (and similar for X protection)
should be enough. Module reloads would still require juggling with the
protections, but I think it is all feasible.
Just had a browse around the module code, and while the section info is
in load_info, it doesn't get retained for active modules.

So I suppose I'll go add that for KLP enabled things.
Elf section info does get saved for livepatch modules though, see
mod->klp_info. And wouldn't this only be needed for livepatch modules?
Right, I just found that, but it is x86 only for some mysterious reason.
And yes, it's KLP only.

I was thikning of adding a KLP only list of {name,addr,size} sections
that start with ".klp" in layout_sections(). Would that not work across
architectures?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help