[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3ac65601-7102-4ad1-ad89-157f7d9cef87@app.fastmail.com>
Date: Mon, 25 Mar 2024 21:40:41 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Samuel Holland" <samuel.holland@...ive.com>,
"Palmer Dabbelt" <palmer@...belt.com>, linux-riscv@...ts.infradead.org
Cc: "Albert Ou" <aou@...s.berkeley.edu>,
"Alexandre Ghiti" <alexghiti@...osinc.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Charlie Jenkins" <charlie@...osinc.com>, guoren <guoren@...nel.org>,
"Jisheng Zhang" <jszhang@...nel.org>,
"Kemeng Shi" <shikemeng@...weicloud.com>,
"Matthew Wilcox" <willy@...radead.org>, "Mike Rapoport" <rppt@...nel.org>,
"Paul Walmsley" <paul.walmsley@...ive.com>,
"Xiao W Wang" <xiao.w.wang@...el.com>, "Yangyu Chen" <cyy@...self.name>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok()
On Wed, Mar 13, 2024, at 18:59, Samuel Holland wrote:
> TASK_SIZE_MAX should be set to the largest userspace address under any
> runtime configuration. This optimizes the check in __access_ok(), which
> no longer needs to compute the current value of TASK_SIZE. It is still
> safe because addresses between TASK_SIZE and TASK_SIZE_MAX are invalid
> at the hardware level.
>
> This removes about half of the references to pgtable_l[45]_enabled.
>
> Signed-off-by: Samuel Holland <samuel.holland@...ive.com>
Reviewed-by: Arnd Bergmann <arnd@...db.de>
> #ifdef CONFIG_64BIT
> #define TASK_SIZE_64 (PGDIR_SIZE * PTRS_PER_PGD / 2)
> #define TASK_SIZE_MIN (PGDIR_SIZE_L3 * PTRS_PER_PGD / 2)
> +#define TASK_SIZE_MAX (PGDIR_SIZE_L5 * PTRS_PER_PGD / 2)
I see that TASK_SIZE_MIN is unused since 085e2ff9aeb0 ("efi:
libstub: Drop randomization of runtime memory map") and could
be dropped now, but it doesn't really hurt either.
Arnd
Powered by blists - more mailing lists