Re: [PATCH] execmem: enforce allocation size aligment to PAGE_SIZE

From: Peter Zijlstra
Date: Thu Apr 24 2025 - 04:57:45 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?

It should not -- currently all this code is used with PAGE_SIZE
multiples and everything just works. But whilst I was perusing this
code, I noticed that nothing actually enforced this. If someone were to
break this assumption things will go sideways.