Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-24 Thread Mike Rapoport
Hi Nathan, On Mon, Oct 21, 2024 at 03:15:19PM -0700, Nathan Chancellor wrote: > Hi Mike, > > On Wed, Oct 16, 2024 at 03:24:22PM +0300, Mike Rapoport wrote: > > From: "Mike Rapoport (Microsoft)" > > > > When module text memory will be allocated with ROX permissions, the > > memory at the actual

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-21 Thread Nathan Chancellor
Hi Mike, On Wed, Oct 16, 2024 at 03:24:22PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > When module text memory will be allocated with ROX permissions, the > memory at the actual address where the module will live will contain > invalid instructions and there will be a wr

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-19 Thread Mike Rapoport
On Thu, Oct 17, 2024 at 10:17:12AM -0400, Steven Rostedt wrote: > On Wed, 16 Oct 2024 17:01:28 -0400 > Steven Rostedt wrote: > > > If this is only needed for module load, can we at least still use the > > text_poke_early() at boot up? > > > > if (ftrace_poke_late) { > > text_poke

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-17 Thread Steven Rostedt
On Thu, 17 Oct 2024 14:25:05 +0300 Mike Rapoport wrote: > With this series the module text is allocated as ROX at the first place, so > the modifications ftrace does to module text have to either use text poking > even before complete_formation() or deal with a writable copy like I did > for relo

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-17 Thread Steven Rostedt
On Wed, 16 Oct 2024 17:01:28 -0400 Steven Rostedt wrote: > If this is only needed for module load, can we at least still use the > text_poke_early() at boot up? > > if (ftrace_poke_late) { > text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > } else if (sys

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-17 Thread Mike Rapoport
On Thu, Oct 17, 2024 at 11:35:15AM +0200, Peter Zijlstra wrote: > On Wed, Oct 16, 2024 at 05:01:28PM -0400, Steven Rostedt wrote: > > On Wed, 16 Oct 2024 15:24:22 +0300 > > Mike Rapoport wrote: > > > > > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > > > index 8da0e66ca22d..b4

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-17 Thread Peter Zijlstra
On Wed, Oct 16, 2024 at 05:01:28PM -0400, Steven Rostedt wrote: > On Wed, 16 Oct 2024 15:24:22 +0300 > Mike Rapoport wrote: > > > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > > index 8da0e66ca22d..b498897b213c 100644 > > --- a/arch/x86/kernel/ftrace.c > > +++ b/arch/x86/kern

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-16 Thread Steven Rostedt
On Wed, 16 Oct 2024 15:24:22 +0300 Mike Rapoport wrote: > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index 8da0e66ca22d..b498897b213c 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -118,10 +118,13 @@ ftrace_modify_code_direct(unsigned long ip

[PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-16 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" When module text memory will be allocated with ROX permissions, the memory at the actual address where the module will live will contain invalid instructions and there will be a writable copy that contains the actual module code. Update relocations and alternati