[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250423145625.GF40412@noisy.programming.kicks-ass.net>
Date: Wed, 23 Apr 2025 16:56:25 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Mike Rapoport <rppt@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] execmem: enforce allocation size aligment to PAGE_SIZE
On Wed, Apr 23, 2025 at 05:48:07PM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
>
> Before introduction of ROX cache execmem allocation size was always
> implicitly aligned to PAGE_SIZE inside vmalloc.
>
> However, when allocation happens from the ROX cache, this is not
> enforced.
>
> Make sure that the allocation size is always consistently aligned to
> PAGE_SIZE.
>
> Fixes: 2e45474ab14f ("execmem: add support for cache of large ROX pages")
> Suggested-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
Thanks!
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> mm/execmem.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/execmem.c b/mm/execmem.c
> index e6c4f5076ca8..2b683e7d864d 100644
> --- a/mm/execmem.c
> +++ b/mm/execmem.c
> @@ -377,6 +377,8 @@ void *execmem_alloc(enum execmem_type type, size_t size)
> pgprot_t pgprot = range->pgprot;
> void *p;
>
> + size = PAGE_ALIGN(size);
> +
> if (use_cache)
> p = execmem_cache_alloc(range, size);
> else
> --
> 2.47.2
>
Powered by blists - more mailing lists