[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjBn=jThQ4drqgorDQFR3i2QUi9PeOG1tH2uWVkN8+6mQ@mail.gmail.com>
Date: Tue, 25 Oct 2022 16:07:25 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: rostedt@...dmis.org, dave.hansen@...el.com,
linux-kernel@...r.kernel.org, x86@...nel.org,
keescook@...omium.org, seanjc@...gle.com
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@...radead.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
Powered by blists - more mailing lists