Messages in this thread | | | From | Linus Torvalds <> | Date | Tue, 25 Oct 2022 16:07:25 -0700 | Subject | Re: [PATCH 0/5] x86/ftrace: Cure boot time W+X mapping |
| |
On Tue, Oct 25, 2022 at 1:11 PM Peter Zijlstra <peterz@infradead.org> wrote: > > These few patches re-work and re-order boot things enough to avoid ftrace > creating boot time W+X maps.
Thanks, looks fine.
> The patches compile and boot for the one config I tested things on (with > ftrace=function enabled; *slooooow*).
So this might be just tracing overhead, but it might also be that you slowed down text_poke() at bootup a _lot_.
The only part that the NX^W checking cared about was that
- if (likely(system_state != SYSTEM_BOOTING)) - set_memory_ro((unsigned long)trampoline, npages); + set_memory_ro((unsigned long)trampoline, npages); set_memory_x((unsigned long)trampoline, npages);
for the create_trampoline(), because without the 'set_memory_ro()', the 'set_memory_x()' will complain.
It does strike me that it's stupid to make those be two calls that do exactly the same thing, and we should have a combined "set it read-only and executable" function, but that's a separate issue.
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.
Linus
| |