From: Peter Zijlstra <peterz@infradead.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] execmem: enforce allocation size aligment to PAGE_SIZE
Date: Wed, 23 Apr 2025 16:56:25 +0200 [thread overview]
Message-ID: <20250423145625.GF40412@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250423144808.1619863-1-rppt@kernel.org>
On Wed, Apr 23, 2025 at 05:48:07PM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.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@infradead.org>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Thanks!
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.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
>
next prev parent reply other threads:[~2025-04-23 14:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 14:48 Mike Rapoport
2025-04-23 14:56 ` Peter Zijlstra [this message]
2025-04-23 21:36 ` Andrew Morton
2025-04-24 5:50 ` Mike Rapoport
2025-04-24 8:53 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250423145625.GF40412@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox