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

From: Arnd Bergmann

Date: Wed Aug 19 2026 - 07:19:54 EST


On Wed, Aug 19, 2026, at 06:56, Karl Mehltretter wrote:
> On Tue, Aug 18, 2026 at 09:31:14AM +0100, Arnd Bergmann wrote:
>> On Tue, Aug 18, 2026, at 05:22, Karl Mehltretter wrote:
> I now used:
>
> CONFIG_EXPERT=y
> CONFIG_ARM64_64K_PAGES=y
> CONFIG_COMPAT=y
> CONFIG_KUSER_HELPERS=y
> CONFIG_COMPAT_ALIGNMENT_FIXUPS=y
> CONFIG_DEFAULT_MMAP_MIN_ADDR=0
>
> With 64K pages and KUSER_HELPERS, compat TASK_SIZE is 4 GiB. The last
> 64K is the kuser mapping. The test maps the first 64K at zero, so memory
> exists on both sides of the wrap.

Hopefully nobody actually uses CONFIG_DEFAULT_MMAP_MIN_ADDR=0.

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.

> On native ARM32, the kernel is mapped at the top of the address space.
> Userspace cannot reach the 4 GiB wrap.

right

> So v2 is enough for the original decrementing LDM/STM bug. v1 does not
> add a working wrap case by itself. I think the small v2 fix makes more
> sense. v1+ would be the theoretically complete version for AArch32 wrap
> handling...
>
> Am I getting this right now, or am I still missing a case?

That sounds good, v2 should be all we need then.

Arnd