From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wfhigh7-smtp.messagingengine.com (wfhigh7-smtp.messagingengine.com [64.147.123.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45A8958AA9 for ; Mon, 25 Mar 2024 20:38:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399127; cv=none; b=X8OzUvdYriP70/3XLG/Drmp4KuZimMNdeJ5Mron/uObp9UqY2xeLfMCy6nLb4H2jymnjLEn3AtLZG/h+AwtRK8eY8/wIbEUACvVFsRmYKIfjiL8VoJb1BPzXXsa9+b7YW4W90/RylO//iBT2pCSeBlplryMbk/PB7Tm1E6adzR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399127; c=relaxed/simple; bh=iT9eyly6DP9h37ybQ3m67Bk2Y0xru04w5y6qfNtN6IE=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=g5iS6d2qXwkQ76iTHmuCrG/YxskPgyTyMsCeqyaBHbiyuyzt2t/xS77stYYb7fDKWBVNBrJmlhlwrcpK2qpDSMLd7OXvRS6PA8vP1TEIDg76AYAYiBnZFdszZwLZB7EaZnj0HfgojWj78r1ukofH16qzIsQLY9hEPcZB2d24Gl0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=S4+3f3pI; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=u32nqvW/; arc=none smtp.client-ip=64.147.123.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="S4+3f3pI"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="u32nqvW/" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id A423818000EC; Mon, 25 Mar 2024 16:38:42 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 25 Mar 2024 16:38:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1711399122; x=1711485522; bh=mhY6UWFYLp GLu9vdotPDgrt7ybIuTPjbMRoJG2CzZUQ=; b=S4+3f3pI+YNgZTkRsaTjGJfLRs Xweu5smHhWwlqgrDI5QfCAjfgKFimPLMcOtAiJFv9/+2Ra9A/7aH1LkVcqmybvFh a62M9OJKTCjVXetf4lH2HozBSdq2g99we27It3uiAagqrnSbyyPNCXKPlXsGHA01 dWj9L/w1en8+0bV3DC03xKTtylfxZkqSzuIMVIdMp+ZuToAhsV1HFhgs5AR7g4z3 +ILghfHMnso8IbL5sCA9knFCp8TTNknARg0qrSGU8ZGb3G2vXpnQeZDL58lJ05E5 HWT7F2C3rD3t9OCUpExjwaogVlQlQ5p6pnVciE8fRZJXpxqO7LOco2rywpkg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1711399122; x=1711485522; bh=mhY6UWFYLpGLu9vdotPDgrt7ybIu TPjbMRoJG2CzZUQ=; b=u32nqvW/CcrUFWOplIZK0gE8RfI4wQqWSTaOJbichPqW F8wAjfnUQjVn6L1ZoVu8P/ujI6RfbOfxe1DOGbHvnfKaY255IPvHJdSF0SUgSDPg z5C6fLvVhJ8v4quxdLI+ifwlTBrEjbS2I7omtvfmSPMTqrVPLu7ZzVUa0aDuziXJ /JjEORS7k19yFUnGMEI8iN2Bch5bpCr8lykf2U5hKsVn8YoVB0A2Jnh9v36AxQTb 1oXCVPR94ANzzSZDHaERbmizhb6r8RQX4Y5gFT3g1Uxkoc08yfETn4fv1ntVXIzU DlORhxg/MTZyG+LlHQMP7/vBiOVxsF2fY0yIa+2+6Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduuddgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvefhffeltdegheeffffhtdegvdehjedtgfekueevgfduffettedtkeekueef hedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 484A7B6008D; Mon, 25 Mar 2024 16:38:41 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-332-gdeb4194079-fm-20240319.002-gdeb41940 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <95eb125d-dd54-42f1-b080-938faca6a8a1@app.fastmail.com> In-Reply-To: References: <20240313180010.295747-1-samuel.holland@sifive.com> <88de4a1a-047e-4be9-b5b0-3e53434dc022@sifive.com> Date: Mon, 25 Mar 2024 21:38:20 +0100 From: "Arnd Bergmann" To: "Mark Rutland" Cc: "Alexandre Ghiti" , "David Laight" , "Samuel Holland" , "Alexandre Ghiti" , "Palmer Dabbelt" , "linux-riscv@lists.infradead.org" , "Albert Ou" , "Andrew Morton" , "Charlie Jenkins" , guoren , "Jisheng Zhang" , "Kemeng Shi" , "Matthew Wilcox" , "Mike Rapoport" , "Paul Walmsley" , "Xiao W Wang" , "Yangyu Chen" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] riscv: Define TASK_SIZE_MAX for __access_ok() Content-Type: text/plain 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