On Thu, Sep 21, 2023 at 03:52:21PM -0700, Song Liu wrote:
> On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote:
> >
> [...]
> > diff --git a/include/linux/execmem.h b/include/linux/execmem.h
> > index 519bdfdca595..09d45ac786e9 100644
> > --- a/include/linux/exe
On Thu, Sep 21, 2023 at 03:10:26PM -0700, Song Liu wrote:
> On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote:
> >
> [...]
> > +
> > +#include
> > +#include
> > +#include
> > +#include
> > +
> > +static void *execmem_alloc(si
On Thu, Sep 21, 2023 at 03:14:54PM -0700, Song Liu wrote:
> On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote:
> >
> [...]
> > +
> > +/**
> > + * enum execmem_type - types of executable memory ranges
> > + *
> > + * There are several
On Thu, Sep 21, 2023 at 03:34:18PM -0700, Song Liu wrote:
> On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote:
> >
>
> [...]
>
> > diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
> > index 42215f9404af..db5561d0c233 100644
> > --- a/arch
From: "Mike Rapoport (IBM)"
BPF just-in-time compiler depended on CONFIG_MODULES because it used
module_alloc() to allocate memory for the generated code.
Since code allocations are now implemented with execmem, drop dependency of
CONFIG_BPF_JIT on CONFIG_MODULES and make
From: "Mike Rapoport (IBM)"
kprobes depended on CONFIG_MODULES because it has to allocate memory for
code.
Since code allocations are now implemented with execmem, kprobes can be
enabled in non-modular kernels.
Add #ifdef CONFIG_MODULE guards for the code dealing with kprobes insi
From: "Mike Rapoport (IBM)"
Dynamic ftrace must allocate memory for code and this was impossible
without CONFIG_MODULES.
With execmem separated from the modules code, execmem_text_alloc() is
available regardless of CONFIG_MODULES.
Remove dependency of dynamic ftrace on CONFIG_MODULE
From: "Mike Rapoport (IBM)"
execmem does not depend on modules, on the contrary modules use
execmem.
To make execmem available when CONFIG_MODULES=n, for instance for
kprobes, split execmem_params initialization out from
arch/kernel/module.c and compile it when CONFIG_EXECMEM=y
From: "Mike Rapoport (IBM)"
powerpc overrides kprobes::alloc_insn_page() to remove writable
permissions when STRICT_MODULE_RWX is on.
Add definition of EXECMEM_KRPOBES to execmem_params to allow using the
generic kprobes::alloc_insn_page() with the desired permissions.
As po
From: "Mike Rapoport (IBM)"
The memory allocations for kprobes and BPF on RISC-V are not placed in
the modules area and these custom allocations are implemented with
overrides of alloc_insn_page() and bpf_jit_alloc_exec().
Slightly reorder execmem_params initialization to suppo
From: "Mike Rapoport (IBM)"
The memory allocations for kprobes and BPF on arm64 can be placed
anywhere in vmalloc address space and currently this is implemented with
overrides of alloc_insn_page() and bpf_jit_alloc_exec() in arm64.
Define EXECMEM_KPROBES and EXECMEM_BPF range
From: "Mike Rapoport (IBM)"
Data related to code allocations, such as module data section, need to
comply with architecture constraints for its placement and its
allocation right now was done using execmem_text_alloc().
Create a dedicated API for allocating data related to code a
From: "Mike Rapoport (IBM)"
Define default parameters for address range for code allocations using
the current values in module_alloc() and make execmem_text_alloc() use
these defaults when an architecture does not supply its specific
parameters.
With this, execmem_text_alloc()
From: "Mike Rapoport (IBM)"
Extend execmem parameters to accommodate more complex overrides of
module_alloc() by architectures.
This includes specification of a fallback range required by arm, arm64
and powerpc and support for allocation of KASAN shadow required by
arm64, s3
From: "Mike Rapoport (IBM)"
Several architectures override module_alloc() only to define address
range for code allocations different than VMALLOC address space.
Provide a generic implementation in execmem that uses the parameters
for address space ranges, required alignmen
From: "Mike Rapoport (IBM)"
module_alloc() is used everywhere as a mean to allocate memory for code.
Beside being semantically wrong, this unnecessarily ties all subsystems
that need to allocate code, such as ftrace, kprobes and BPF to modules
and puts the burden of code
From: "Mike Rapoport (IBM)"
nios2 uses kmalloc() to implement module_alloc() because CALL26/PCREL26
cannot reach all of vmalloc address space.
Define module space as 32MiB below the kernel base and switch nios2 to
use vmalloc for module allocations.
Suggested-by: Thomas Gleix
From: "Mike Rapoport (IBM)"
Hi,
module_alloc() is used everywhere as a mean to allocate memory for code.
Beside being semantically wrong, this unnecessarily ties all subsystmes
that need to allocate code, such as ftrace, kprobes and BPF to modules and
puts the burden of code
On Mon, Jun 05, 2023 at 11:09:34AM +0100, Mark Rutland wrote:
> On Mon, Jun 05, 2023 at 12:20:40PM +0300, Mike Rapoport wrote:
> > On Fri, Jun 02, 2023 at 10:35:09AM +0100, Mark Rutland wrote:
> > > On Thu, Jun 01, 2023 at 02:14:56PM -0400, Kent Overstreet wrote:
> > > &
On Sun, Jun 25, 2023 at 09:59:34AM -0700, Andy Lutomirski wrote:
>
>
> On Sun, Jun 25, 2023, at 9:14 AM, Mike Rapoport wrote:
> > On Mon, Jun 19, 2023 at 10:09:02AM -0700, Andy Lutomirski wrote:
> >>
> >> On Sun, Jun 18, 2023, at 1:00 AM, Mike Rapoport wrote:
On Mon, Jun 19, 2023 at 10:09:02AM -0700, Andy Lutomirski wrote:
>
> On Sun, Jun 18, 2023, at 1:00 AM, Mike Rapoport wrote:
> > On Sat, Jun 17, 2023 at 01:38:29PM -0700, Andy Lutomirski wrote:
> >> On Fri, Jun 16, 2023, at 1:50 AM, Mike Rapoport wrote:
> >&g
On Mon, Jun 19, 2023 at 12:32:55AM +0200, Thomas Gleixner wrote:
> Mike!
>
> Sorry for being late on this ...
>
> On Fri, Jun 16 2023 at 11:50, Mike Rapoport wrote:
>
> The fact that my suggestions had a 'mod_' namespace prefix does not make
> any of my points moot.
Th
On Sat, Jun 17, 2023 at 01:38:29PM -0700, Andy Lutomirski wrote:
> On Fri, Jun 16, 2023, at 1:50 AM, Mike Rapoport wrote:
> > From: "Mike Rapoport (IBM)"
> >
> > module_alloc() is used everywhere as a mean to allocate memory for code.
> >
> > Beside b
On Fri, Jun 16, 2023 at 01:05:29PM -0700, Song Liu wrote:
> On Fri, Jun 16, 2023 at 1:52 AM Mike Rapoport wrote:
> >
> > From: "Mike Rapoport (IBM)"
> >
> > The memory allocations for kprobes on arm64 can be placed anywhere in
> > vmalloc addr
On Fri, Jun 16, 2023 at 01:44:55PM +0200, Björn Töpel wrote:
> Mike Rapoport writes:
>
> > From: "Mike Rapoport (IBM)"
> >
> > kprobes depended on CONFIG_MODULES because it has to allocate memory for
> > code.
>
> I think you can remove the MOD
On Fri, Jun 16, 2023 at 01:01:08PM -0700, Song Liu wrote:
> On Fri, Jun 16, 2023 at 1:51 AM Mike Rapoport wrote:
> >
> > From: "Mike Rapoport (IBM)"
> >
> > Data related to code allocations, such as module data section, need to
> > comply with archite
On Fri, Jun 16, 2023 at 04:55:53PM +, Edgecombe, Rick P wrote:
> On Fri, 2023-06-16 at 11:50 +0300, Mike Rapoport wrote:
> > From: "Mike Rapoport (IBM)"
> >
> > Data related to code allocations, such as module data section, need
> > to
> > c
On Fri, Jun 16, 2023 at 11:53:54AM -0700, Song Liu wrote:
> On Fri, Jun 16, 2023 at 1:51 AM Mike Rapoport wrote:
> [...]
> > diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> > index 5af4975caeb5..c3d999f3a3dd 100644
> > --- a/arch/arm64/kernel/modul
On Fri, Jun 16, 2023 at 04:16:28PM +, Edgecombe, Rick P wrote:
> On Fri, 2023-06-16 at 11:50 +0300, Mike Rapoport wrote:
> > -void *module_alloc(unsigned long size)
> > -{
> > - gfp_t gfp_mask = GFP_KERNEL;
> > - void *p;
> > -
> > -
On Fri, Jun 16, 2023 at 12:48:02PM -0400, Kent Overstreet wrote:
> On Fri, Jun 16, 2023 at 11:50:28AM +0300, Mike Rapoport wrote:
> > From: "Mike Rapoport (IBM)"
> >
> > module_alloc() is used everywhere as a mean to allocate memory for code.
> >
On Fri, Jun 16, 2023 at 04:00:19PM +, Edgecombe, Rick P wrote:
> On Fri, 2023-06-16 at 11:50 +0300, Mike Rapoport wrote:
> > void *module_alloc(unsigned long size)
> > {
> > - if (size == 0)
> > - return NULL;
> > -
From: "Mike Rapoport (IBM)"
kprobes depended on CONFIG_MODULES because it has to allocate memory for
code.
Since code allocations are now implemented with execmem, kprobes can be
enabled in non-modular kernels.
Add #ifdef CONFIG_MODULE guards for the code dealing with kprobes insi
From: "Mike Rapoport (IBM)"
Dynamic ftrace must allocate memory for code and this was impossible
without CONFIG_MODULES.
With execmem separated from the modules code, execmem_text_alloc() is
available regardless of CONFIG_MODULES.
Remove dependency of dynamic ftrace on CONFIG_MODULE
From: "Mike Rapoport (IBM)"
execmem does not depend on modules, on the contrary modules use
execmem.
To make execmem available when CONFIG_MODULES=n, for instance for
kprobes, split execmem_params initialization out from
arch/kernel/module.c and compile it when CONFIG_EXECMEM=y
From: "Mike Rapoport (IBM)"
powerpc overrides kprobes::alloc_insn_page() to remove writable
permissions when STRICT_MODULE_RWX is on.
Add definition of jit area to execmem_params to allow using the generic
kprobes::alloc_insn_page() with the desired permissions.
As powerpc uses
From: "Mike Rapoport (IBM)"
RISC-V overrides kprobes::alloc_insn_range() to use the entire vmalloc area
rather than limit the allocations to the modules area.
Slightly reorder execmem_params initialization to support both 32 and 64
bit variantsi and add definition of jit area to exec
From: "Mike Rapoport (IBM)"
The memory allocations for kprobes on arm64 can be placed anywhere in
vmalloc address space and currently this is implemented with an override
of alloc_insn_page() in arm64.
Extend execmem_params with a range for generated code allocations and
make kprobe
From: "Mike Rapoport (IBM)"
Data related to code allocations, such as module data section, need to
comply with architecture constraints for its placement and its
allocation right now was done using execmem_text_alloc().
Create a dedicated API for allocating data related to code a
From: "Mike Rapoport (IBM)"
Define default parameters for address range for code allocations using
the current values in module_alloc() and make execmem_text_alloc() use
these defaults when an architecure does not supply its specific
parameters.
With this, execmem_text_alloc() impleme
From: "Mike Rapoport (IBM)"
Extend execmem parameters to accommodate more complex overrides of
module_alloc() by architectures.
This includes specification of a fallback range required by arm, arm64
and powerpc and support for allocation of KASAN shadow required by
arm64, s3
From: "Mike Rapoport (IBM)"
Several architectures override module_alloc() only to define address
range for code allocations different than VMALLOC address space.
Provide a generic implementation in execmem that uses the parameters
for address space ranges, required alignmen
From: "Mike Rapoport (IBM)"
module_alloc() is used everywhere as a mean to allocate memory for code.
Beside being semantically wrong, this unnecessarily ties all subsystems
that need to allocate code, such as ftrace, kprobes and BPF to modules
and puts the burden of code
From: "Mike Rapoport (IBM)"
nios2 uses kmalloc() to implement module_alloc() because CALL26/PCREL26
cannot reach all of vmalloc address space.
Define module space as 32MiB below the kernel base and switch nios2 to
use vmalloc for module allocations.
Suggested-by: Thomas Gleixner
From: "Mike Rapoport (IBM)"
Hi,
module_alloc() is used everywhere as a mean to allocate memory for code.
Beside being semantically wrong, this unnecessarily ties all subsystmes
that need to allocate code, such as ftrace, kprobes and BPF to modules and
puts the burden of code
ge_ctor
arch/riscv/mm/init.c:440: BUG_ON(!vaddr ||
!pgtable_pmd_page_ctor(virt_to_page(vaddr)));
Otherwise
Acked-by: Mike Rapoport (IBM)
> ---
> Documentation/mm/split_page_table_lock.rst| 12 +--
> .../zh_CN/mm/split_page_table_lock.rst| 14 ++---
On Mon, Jun 12, 2023 at 02:04:22PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents. Also cleans up some spacing issues.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
>
On Mon, Jun 12, 2023 at 02:04:21PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable pte constructor/destructors with
> ptdesc equivalents.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/sparc/mm/srmmu.c |
On Mon, Jun 12, 2023 at 02:04:20PM -0700, Vishal Moola (Oracle) wrote:
> As part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents, convert various page table functions to use ptdescs.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike R
gt; Acked-by: John Paul Adrian Glaubitz
Acked-by: Mike Rapoport (IBM)
> ---
> arch/sh/include/asm/pgalloc.h | 9 +
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
> index a9e98233c4d4.
ons. Convert
> these to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
> Acked-by: Palmer Dabbelt
Acked-by: Mike Rapoport (IBM)
> ---
> arch/riscv/include/asm/pgalloc.h | 8
On Mon, Jun 12, 2023 at 02:04:17PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/openrisc/include
On Mon, Jun 12, 2023 at 02:04:16PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/nios2/include
ons. Convert
> these to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/mips/include/asm/pgalloc.h | 31 +--
> arc
ons. Convert
> these to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
One comment below
> ---
> arch/m68k/include/asm/mcf_pgalloc.h | 41 ++-
ons. Convert
> these to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/loongarch/include/asm/pgalloc.h | 27 +++
On Mon, Jun 12, 2023 at 02:04:12PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/hexagon/include
On Mon, Jun 12, 2023 at 02:04:11PM -0700, Vishal Moola (Oracle) wrote:
> Part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents.
>
> Signed-off-by: Vishal Moola (Oracle)
> Acked-by: Guo Ren
Acked-by: Mike Rapoport (IBM)
> ---
>
On Mon, Jun 12, 2023 at 02:04:10PM -0700, Vishal Moola (Oracle) wrote:
> As part of the conversions to replace pgtable constructor/destructors with
> ptdesc equivalents, convert various page table functions to use ptdescs.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike R
ion. Convert
> this to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
One comment below.
> ---
> arch/arm/include/asm/tlb.h | 12 +++-
>
ptdesc_address(ptdesc);
> }
>
> #ifndef __HAVE_ARCH_PUD_ALLOC_ONE
> @@ -175,7 +187,7 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm,
> unsigned long addr)
> static inline void __pud_free(struct mm_struct *mm, pud_t *pud)
> {
> BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
> - free_page((unsigned long)pud);
> + pagetable_free(virt_to_ptdesc(pud));
> }
>
> #ifndef __HAVE_ARCH_PUD_FREE
> @@ -190,7 +202,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t
> *pud)
> #ifndef __HAVE_ARCH_PGD_FREE
> static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
> {
> - free_page((unsigned long)pgd);
> + pagetable_free(virt_to_ptdesc(pgd));
> }
> #endif
>
> --
> 2.40.1
>
>
--
Sincerely yours,
Mike.
On Mon, Jun 12, 2023 at 02:04:07PM -0700, Vishal Moola (Oracle) wrote:
> The page table members are now split out into their own ptdesc struct.
> Remove them from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> include/lin
ons. Convert
> these to use pagetable_alloc() and ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/s390/include/asm/pgalloc.h | 4 +-
> arch/s390/include/asm/tlb.h |
ptdesc_address() instead to help
> standardize page tables further.
>
> Signed-off-by: Vishal Moola (Oracle)
With folding
ptdesc->_pt_s390_gaddr = 0;
into pagetable_free()
Acked-by: Mike Rapoport (IBM)
> ---
> arch/s390/mm/gmap.c | 230 -
ptdesc = NULL;
> failed = true;
> }
> - if (pmd)
> + if (ptdesc) {
> mm_inc_nr_pmds(mm);
> + pmd = ptdesc_address(ptdesc);
> + }
> +
> pmds[i] = pmd;
> }
>
> @@ -830,7 +838,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr)
>
> free_page((unsigned long)pmd_sv);
>
> - pgtable_pmd_page_dtor(virt_to_page(pmd));
> + pagetable_pmd_dtor(virt_to_ptdesc(pmd));
> free_page((unsigned long)pmd);
>
> return 1;
> --
> 2.40.1
>
>
--
Sincerely yours,
Mike.
On Mon, Jun 12, 2023 at 02:04:03PM -0700, Vishal Moola (Oracle) wrote:
> In order to split struct ptdesc from struct page, convert various
> functions to use ptdescs.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/powerpc/mm/book3s64/
"create ... make"
I like the second form more.
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> include/linux/mm.h | 56 ++
> 1 file changed, 42 insertions(+), 14 deletions(-)
>
> diff --git a/
On Mon, Jun 12, 2023 at 02:04:01PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> inclu
On Mon, Jun 12, 2023 at 02:04:00PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> inclu
On Mon, Jun 12, 2023 at 02:03:59PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> inclu
On Mon, Jun 12, 2023 at 02:03:58PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> inclu
On Mon, Jun 12, 2023 at 02:03:57PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> arch/x86
On Mon, Jun 12, 2023 at 02:03:56PM -0700, Vishal Moola (Oracle) wrote:
> This removes some direct accesses to struct page, working towards
> splitting out struct ptdesc from struct page.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> incl
l Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> include/linux/mm.h | 8
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index f184f1eba85d..088b7664f897 100644
> --- a/include/linux/mm.h
> +++ b/in
struct ptdesc *:(struct page *)(pt)))
> +
> +#define ptdesc_folio(pt) (_Generic((pt), \
> + const struct ptdesc *: (const struct folio *)(pt), \
> + struct ptdesc *:(struct folio *)(pt)))
> +
> +#define page_ptdesc(p) (_Generic((p),
> \
> + const struct page *:(const struct ptdesc *)(p), \
> + struct page *: (struct ptdesc *)(p)))
> +
> /*
> * No-op macros that just return the current protection value. Defined here
> * because these macros can be used even if CONFIG_MMU is not defined.
> --
> 2.40.1
>
>
--
Sincerely yours,
Mike.
On Mon, Jun 12, 2023 at 02:03:53PM -0700, Vishal Moola (Oracle) wrote:
> Currently, page table information is stored within struct page. As part
> of simplifying struct page, create struct ptdesc for page table
> information.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mik
his improves the safety for _refcount and the page table tracking.
>
> This also allows us to simplify the tracking since we can once again use
> the lower byte of pt_frag_refcount instead of the upper byte of _refcount.
>
> Signed-off-by: Vishal Moola (Oracle)
One nit below
d be the right place for that.
Otherwise:
Acked-by: Mike Rapoport (IBM)
> This also reverts commit 7e25de77bc5ea ("s390/mm: use pmd_pgtable_page()
> helper in __gmap_segment_gaddr()") which had s390 use
> pmd_pgtable_page() to get a gmap page table, as pmd_pgtable_page()
&g
the memory here.
>
> Signed-off-by: Vishal Moola (Oracle)
Acked-by: Mike Rapoport (IBM)
> ---
> include/linux/page-flags.h | 20 ++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>
vger.kernel.org
> Cc: linux...@lists.infradead.org
> Cc: linux-a...@vger.kernel.org
> Cc: linux...@kvack.org
> Suggested-by: Linus Torvalds
> Signed-off-by: Rick Edgecombe
> Link:
> https://lore.kernel.org/lkml/CAHk-=wizjsu7c9sfyzb3q04108stghff2wfbokgccgw7riz...@mail.gmail.com/
Reviewed-by: Mike Rapoport (IBM)
--
Sincerely yours,
Mike.
On Tue, Jun 13, 2023 at 02:56:14PM -0400, Kent Overstreet wrote:
> On Thu, Jun 08, 2023 at 09:41:16PM +0300, Mike Rapoport wrote:
> > On Tue, Jun 06, 2023 at 11:21:59AM -0700, Song Liu wrote:
> > > On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote:
> > >
> > >
On Fri, Jun 09, 2023 at 10:02:16AM -0700, Song Liu wrote:
> On Thu, Jun 8, 2023 at 11:41 AM Mike Rapoport wrote:
> >
> > On Tue, Jun 06, 2023 at 11:21:59AM -0700, Song Liu wrote:
> > > On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote:
> > >
> > > [
ULES_END,
.pgprot = PAGE_KERNEL_ROX,
},
},
.jit_range = {},/* impplies reusing .modules */
};
struct execmem_params default_execmem = {
.modules = {
.flags = KASAN,
.text = {
.start = VMALLOC_START,
.end = VMALLOC_END,
.pgprot = PAGE_KERNEL_EXEC,
},
},
};
--
Sincerely yours,
Mike.
On Mon, Jun 05, 2023 at 11:09:34AM +0100, Mark Rutland wrote:
> On Mon, Jun 05, 2023 at 12:20:40PM +0300, Mike Rapoport wrote:
> > On Fri, Jun 02, 2023 at 10:35:09AM +0100, Mark Rutland wrote:
> >
> > It sill can be achieved with a single jit_alloc_arch_params(), just by
>
On Mon, Jun 05, 2023 at 04:10:21PM +, Edgecombe, Rick P wrote:
> On Mon, 2023-06-05 at 11:11 +0300, Mike Rapoport wrote:
> > On Sun, Jun 04, 2023 at 10:52:44PM -0400, Steven Rostedt wrote:
> > > On Thu, 1 Jun 2023 16:54:36 -0700
> > > Nadav Amit wrote:
> &g
extra
> > parameter is just "does this allocation need to live close to kernel
> > text", that's not that big of a deal.
>
> My thinking was that we at least need the start + end for each caller. That
> might be it, tbh.
Do you mean that modules will have something like
jit_text_alloc(size, MODULES_START, MODULES_END);
and kprobes will have
jit_text_alloc(size, KPROBES_START, KPROBES_END);
?
It sill can be achieved with a single jit_alloc_arch_params(), just by
adding enum jit_type parameter to jit_text_alloc().
[1] https://lore.kernel.org/linux-mm/87v8mndy3y.ffs@tglx/
[2] https://lore.kernel.org/all/20230526051529.3387103-1-s...@kernel.org
> Thanks,
> Mark.
--
Sincerely yours,
Mike.
beginning of apply_relocate_*() and module_finalize(),
then it will use memcpy() to that writable alias and will tear the mapping
down in the end.
Another option is to teach alternatives to update a writable copy rather
than do in place changes like Song suggested. My feeling is that it will be
more intrusive change though.
> -- Steve
>
--
Sincerely yours,
Mike.
On Thu, Jun 01, 2023 at 12:30:50PM +0200, Peter Zijlstra wrote:
> On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote:
>
> > +static void __init_or_module do_text_poke(void *addr, const void *opcode,
> > size_t len)
> > +{
> > + if
From: "Mike Rapoport (IBM)"
When STRICT_KERNEL_RWX or STRICT_MODULE_RWX is enabled, force text
allocations to use KERNEL_PAGE_ROX.
Signed-off-by: Mike Rapoport (IBM)
---
arch/Kconfig | 3 +++
arch/x86/Kconfig | 1 +
arch/x86/kernel/ftrace.c | 3 ---
arch/x86
before writing to it and to protect memory in the
end.
Signed-off-by: Song Liu
Co-developed-by: Mike Rapoport (IBM)
Signed-off-by: Mike Rapoport (IBM)
---
arch/x86/kernel/alternative.c | 43 +++
arch/x86/kernel/ftrace.c | 41
From: Song Liu
ftrace_process_locs sorts module mcount, which is inside RO memory. Add a
ftrace_swap_func so that archs can use RO-memory-poke function to do the
sorting.
Signed-off-by: Song Liu
---
include/linux/ftrace.h | 2 ++
kernel/trace/ftrace.c | 13 -
2 files changed, 14
From: "Mike Rapoport (IBM)"
When executable memory will be allocated as ROX it won't be possible to
update it using memset() and memcpy().
Introduce jit_update_copy() and jit_update_set() APIs and use them in
modules loading code instead of memcpy() and memset().
Signed-off-by: Mik
From: "Mike Rapoport (IBM)"
kprobes depended on CONFIG_MODULES because it has to allocate memory for
code.
Since code allocations are now implemented with jitalloc, kprobes can be
enabled in non-modular kernels.
Add #ifdef CONFIG_MODULE guars for the code dealing with kprobes insi
From: "Mike Rapoport (IBM)"
jitalloc does not depend on modules, on the contrary modules use
jitalloc.
To make jitalloc available when CONFIG_MODULES=n, for instance for
kprobes, split jit_alloc_params initialization out from
arch/kernel/module.c and compile it when CONFIG_JIT_ALLOC
From: "Mike Rapoport (IBM)"
Dynamic ftrace must allocate memory for code and this was impossible
without CONFIG_MODULES.
With jitalloc separated from the modules code, the jit_text_alloc() is
available regardless of CONFIG_MODULE.
Move jitalloc initialization to x86/mm/init.c so tha
From: "Mike Rapoport (IBM)"
Data related to code allocations, such as module data section, need to
comply with architecture constraints for its placement and its
allocation right now was done using jit_text_alloc().
Create a dedicated API for allocating data related to code a
From: "Mike Rapoport (IBM)"
Define default parameters for address range for code allocations
using the current values in module_alloc() and make jit_text_alloc() use
these defaults when an architecure does not supply its specific
parameters.
With this, jit_text_alloc() impleme
From: "Mike Rapoport (IBM)"
Extend jitalloc parameters to accommodate more complex overrides of
module_alloc() by architectures.
This includes specification of a fallback range required by arm, arm64
and powerpc and support for allocation of KASAN shadow required by
arm64, s3
From: "Mike Rapoport (IBM)"
Several architectures override module_alloc() only to define address
range for code allocations different than VMALLOC address space.
Provide a generic implementation in jitalloc that uses the parameters
for address space ranges, required alignmen
From: "Mike Rapoport (IBM)"
module_alloc() is used everywhere as a mean to allocate memory for code.
Beside being semantically wrong, this unnecessarily ties all subsystmes
that need to allocate code, such as ftrace, kprobes and BPF to modules
and puts the burden of code
From: "Mike Rapoport (IBM)"
nios2 uses kmalloc() to implement module_alloc() because CALL26/PCREL26
cannot reach all of vmalloc address space.
Define module space as 32MiB below the kernel base and switch nios2 to
use vmalloc for module allocations.
Suggested-by: Thomas Gleixner
201 - 300 of 1493 matches
Mail list logo