Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Karl Mehltretter" <kmehltretter@gmail.com>
Cc: "Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: compat: Keep alignment address arithmetic 32-bit
Date: Wed, 19 Aug 2026 22:27:06 +0200	[thread overview]
Message-ID: <20969b87-a073-491b-960d-8c4c2087845b@app.fastmail.com> (raw)
In-Reply-To: <aoX6wpJjMS1vtlVY@gmail.com>

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


      reply	other threads:[~2026-08-19 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  0:02 [PATCH] arm64: compat: Keep alignment address arithmetic 32-bit Karl Mehltretter
2026-08-17  9:15 ` Arnd Bergmann
2026-08-18  3:22   ` Karl Mehltretter
2026-08-18  7:31     ` Arnd Bergmann
2026-08-19  4:56       ` Karl Mehltretter
2026-08-19 11:19         ` Arnd Bergmann
2026-08-19 18:55           ` Karl Mehltretter
2026-08-19 20:27             ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20969b87-a073-491b-960d-8c4c2087845b@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox