Re: [PATCH] execmem: enforce allocation size aligment to PAGE_SIZE
From: Mike Rapoport
Date: Thu Apr 24 2025 - 01:50:51 EST
On Wed, Apr 23, 2025 at 02:36:50PM -0700, Andrew Morton wrote:
> On Wed, 23 Apr 2025 17:48:07 +0300 Mike Rapoport <rppt@xxxxxxxxxx> wrote:
>
> > 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.
>
> Does this have any known runtime effect?
Right now it'll make the maple trees in execmem_cache more compact.
And it's a precaution for the case when execmem callers would want to
change permissions on unaligned range because that would WARN_ON() loudly.
--
Sincerely yours,
Mike.