Re: [PATCH] arm64: compat: Keep alignment address arithmetic 32-bit

From: Arnd Bergmann

Date: Wed Aug 19 2026 - 16:28:00 EST


On Wed, Aug 19, 2026, at 20:55, Karl Mehltretter wrote:
> On Wed, Aug 19, 2026 at 01:19:20PM +0100, Arnd Bergmann wrote:
>>
>> I don't see yet why 64K_PAGES makes a difference. I had
>> expected TASK_SIZE to be 4GiB regardless of the page size, and
>> the top page (but not the bottom page) to be reachable from normal
>> userspace.
>
> There is a special case in arch/arm64/include/asm/processor.h:
>
> #if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
> #define TASK_SIZE_32 UL(0x100000000)
> #else
> #define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE)
> #endif
>
> Only ARM64_64K_PAGES with KUSER_HELPERS gives compat tasks the
> full 4 GiB. The 64K kuser mapping then occupies the last
> page.

Ok, I wasn't aware of this bit at all. I think you can just
skip explaining it in the changelog then and not spend
too much time worrying about the case of userspace intentionally
overflowing the 32-bit address space, as we clearly try hard
to make that impossible in all kinds of ways.

Just explain the important bit with the decrement
causing the compat mode to be completely wrong.

Arnd