From: "Arnd Bergmann" <arnd@arndb.de>
To: "Samuel Holland" <samuel.holland@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org
Cc: "Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Charlie Jenkins" <charlie@rivosinc.com>,
guoren <guoren@kernel.org>, "Jisheng Zhang" <jszhang@kernel.org>,
"Kemeng Shi" <shikemeng@huaweicloud.com>,
"Matthew Wilcox" <willy@infradead.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Xiao W Wang" <xiao.w.wang@intel.com>,
"Yangyu Chen" <cyy@cyyself.name>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok()
Date: Mon, 25 Mar 2024 21:40:41 +0100 [thread overview]
Message-ID: <3ac65601-7102-4ad1-ad89-157f7d9cef87@app.fastmail.com> (raw)
In-Reply-To: <20240313180010.295747-1-samuel.holland@sifive.com>
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@sifive.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Samuel Holland" <samuel.holland@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org
Cc: "Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Charlie Jenkins" <charlie@rivosinc.com>,
guoren <guoren@kernel.org>, "Jisheng Zhang" <jszhang@kernel.org>,
"Kemeng Shi" <shikemeng@huaweicloud.com>,
"Matthew Wilcox" <willy@infradead.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Xiao W Wang" <xiao.w.wang@intel.com>,
"Yangyu Chen" <cyy@cyyself.name>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok()
Date: Mon, 25 Mar 2024 21:40:41 +0100 [thread overview]
Message-ID: <3ac65601-7102-4ad1-ad89-157f7d9cef87@app.fastmail.com> (raw)
In-Reply-To: <20240313180010.295747-1-samuel.holland@sifive.com>
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@sifive.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.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
next prev parent reply other threads:[~2024-03-25 20:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 17:59 [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok() Samuel Holland
2024-03-13 17:59 ` Samuel Holland
2024-03-18 20:50 ` Alexandre Ghiti
2024-03-18 20:50 ` Alexandre Ghiti
2024-03-18 21:29 ` Samuel Holland
2024-03-18 21:29 ` Samuel Holland
2024-03-19 16:51 ` Alexandre Ghiti
2024-03-19 16:51 ` Alexandre Ghiti
2024-03-24 19:42 ` David Laight
2024-03-24 19:42 ` David Laight
2024-03-25 7:30 ` Alexandre Ghiti
2024-03-25 7:30 ` Alexandre Ghiti
2024-03-25 9:30 ` David Laight
2024-03-25 9:30 ` David Laight
2024-03-25 16:39 ` Mark Rutland
2024-03-25 16:39 ` Mark Rutland
2024-03-25 18:02 ` Arnd Bergmann
2024-03-25 18:02 ` Arnd Bergmann
2024-03-25 18:30 ` Mark Rutland
2024-03-25 18:30 ` Mark Rutland
2024-03-25 19:20 ` Samuel Holland
2024-03-25 19:20 ` Samuel Holland
2024-03-25 20:38 ` Arnd Bergmann
2024-03-25 20:38 ` Arnd Bergmann
2024-03-26 10:19 ` David Laight
2024-03-26 10:19 ` David Laight
2024-03-26 14:49 ` Mark Rutland
2024-03-26 14:49 ` Mark Rutland
2024-03-25 20:12 ` Alexandre Ghiti
2024-03-25 20:12 ` Alexandre Ghiti
2024-03-24 22:05 ` Arnd Bergmann
2024-03-24 22:05 ` Arnd Bergmann
2024-03-25 7:25 ` Alexandre Ghiti
2024-03-25 7:25 ` Alexandre Ghiti
2024-03-25 11:15 ` Arnd Bergmann
2024-03-25 11:15 ` Arnd Bergmann
2024-03-25 20:40 ` Arnd Bergmann [this message]
2024-03-25 20:40 ` Arnd Bergmann
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=3ac65601-7102-4ad1-ad89-157f7d9cef87@app.fastmail.com \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=charlie@rivosinc.com \
--cc=cyy@cyyself.name \
--cc=guoren@kernel.org \
--cc=jszhang@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rppt@kernel.org \
--cc=samuel.holland@sifive.com \
--cc=shikemeng@huaweicloud.com \
--cc=willy@infradead.org \
--cc=xiao.w.wang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.