[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <95eb125d-dd54-42f1-b080-938faca6a8a1@app.fastmail.com>
Date: Mon, 25 Mar 2024 21:38:20 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Mark Rutland" <mark.rutland@....com>
Cc: "Alexandre Ghiti" <alex@...ti.fr>,
"David Laight" <David.Laight@...lab.com>,
"Samuel Holland" <samuel.holland@...ive.com>,
"Alexandre Ghiti" <alexghiti@...osinc.com>,
"Palmer Dabbelt" <palmer@...belt.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"Albert Ou" <aou@...s.berkeley.edu>,
"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" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok()
On Mon, Mar 25, 2024, at 19:30, Mark Rutland wrote:
> On Mon, Mar 25, 2024 at 07:02:13PM +0100, Arnd Bergmann wrote:
>> On Mon, Mar 25, 2024, at 17:39, Mark Rutland wrote:
>
>> If an architecture ignores all the top bits of a virtual address,
>> the largest TASK_SIZE would be higher than the smallest (positive,
>> unsigned) PAGE_OFFSET, so you need TASK_SIZE_MAX to be dynamic.
>
> Agreed, but do we even support such architectures within Linux?
Apparently not.
On 32-bit architectures, you often have TASK_SIZE==PAGE_OFFSET,
but not on 64-bit -- either the top few bits in PAGE_OFFSET are
always ones, or the user and kernel page tables are completely
separate.
>> It doesn't look like this is the case on riscv, but I'm not sure
>> about this part.
>
> It looks like riscv is in the same bucket as arm64 and x86 per:
>
> https://www.kernel.org/doc/html/next/riscv/vm-layout.html
>
> ... which says:
>
> | The RISC-V privileged architecture document states that the 64bit addresses
> | "must have bits 63-48 all equal to bit 47, or else a page-fault exception
> | will occur.": that splits the virtual address space into 2 halves separated
> | by a very big hole, the lower half is where the userspace resides, the upper
> | half is where the RISC-V Linux Kernel resides.
Rihgt. I had even looked in that directory but somehow missed
the vm-layout.rst file.
Arnd
Powered by blists - more mailing lists