Subject: Re: [PATCH v2 1/6] ARM: Use PAGE_SIZE for ELF_EXEC_PAGESIZE

From: Gregory CLEMENT <[email-masked]>
Date: Fri, 12 Jun 2020 14:06:18 +0200

Hi Arnd,

> On Fri, Jun 12, 2020 at 10:35 AM Russell King - ARM Linux admin
> <[email-masked]> wrote:
>> On Fri, Jun 12, 2020 at 10:22:17AM +0200, Arnd Bergmann wrote:
>> > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT
>> > <[email-masked]> wrote:
>> > >
>> > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In
>> > > order to be able to use other size of page than 4K, use PAGE_SIZE
>> > > instead of the hardcoded value.
>> > >
>> > > The use of PAGE_SIZE will be also aligned with what we find in other
>> > > architectures such as arm64.
>> > >
>> > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and
>> > > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page
>> > > sizes") from
>> > > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git
>> > >
>> > > Signed-off-by: Gregory CLEMENT <[email-masked]>
>> >
>> > IIRC using page sizes above 16KB here also requires using a
>> > non-ancient linker in user space that places sections on
>> > ELF_EXEC_PAGESIZE boundaries, right?
>
> Correction: I was thinking of SHMLBA, not ELF_EXEC_PAGESIZE.
> SHMLBA is defined to 16KB in arch/arm/ at the moment (based on 4K
> page size), or (4 * PAGE_SIZE) on arm64, which can blow up to 256KB.
>
> AFAICT, SHMLBA should now be defined as "min(16384, PAGE_SIZE)".

We took care of it in patch 5:

+#ifdef CONFIG_ARM_LARGE_PAGE_SUPPORT
+#define    SHMLBA    (16 << 10)         /* attach addr a multiple of (4 * 4096) */
+#else
 #define    SHMLBA    (4 * PAGE_SIZE)         /* attach addr a multiple of this */
+#endif

But your version is better, with it we don't need anymore this ifdef.

Gregory

>
>> Doesn't that mean that this change breaks all existing userspace when
>> ELF_EXEC_PAGESIZE is not 4k?
>
> I think a lot of older user space would be broken with page sizes larger
> than 16KB, but would still work with 8KB or 16KB. Larger page sizes
> would only work with user space that was linked in the last five years
> or so, using a toolchain that has the workarounds for running on arm64
> with 64KB page size.
>
>       Arnd

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel