Re: [PATCH 0/5] x86/ftrace: Cure boot time W+X mapping

From: Steven Rostedt
Date: Tue Oct 25 2022 - 19:17:37 EST


On Tue, 25 Oct 2022 16:07:25 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> The slowness is probably not the trampilines, but just the regular
> "text_poke of kernel text" that we probably want to keep special just
> because otherwise it's _so_ slow to do for every alternative etc.

Yes. That's why I recommended to change patch 4 to:

if (unlikely(system_state == SYSTEM_BOOTING) &&
core_kernel_text((unsigned long)addr)) {
text_poke_early(addr, opcode, len);
return;
}

The only special case we had was the ftrace trampoline that was dynamically
allocated, and there's paths that require updating it (when you add two
function callbacks to the same location).

-- Steve