Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3010922lqp; Mon, 25 Mar 2024 16:54:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVtH7gD5oFus+d0aSnvST/jO4OnLo6As1D5gefu0dU3JrdQv/XEiJadrXl6/6cCbSs0j+PZezwZ850xvRe1cs0Ugp/UKgmvVbHVhaABA== X-Google-Smtp-Source: AGHT+IHBgcr3tei6zQ2AyaI78sjeM6GCMwrET1fMIAY4oSnppQwo0bWjjIf6e3lGBmS1QtMNIh2E X-Received: by 2002:a17:902:d4c1:b0:1e0:d660:18f with SMTP id o1-20020a170902d4c100b001e0d660018fmr2444458plg.36.1711410886482; Mon, 25 Mar 2024 16:54:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711410886; cv=pass; d=google.com; s=arc-20160816; b=ZoKe/9Z/V7t88XU8pVDwCunl0AmEnjC82upG4/xpDL7hgQszqrnOhJ6muMyXskcY9G ntxv4gla32TxDANa9e50AgOgyymxpHQSBohKQZRG6kopEAOe7zPU30DT0S2pQwZPMpYy XkDQVjan7PZf6o+qO+LIae797oJzKtdRwByvZRwHV8YL4yEwDud7WklA3OvutmXKvjWj DayQezHTD+JizTVjmHL+4VoDcDmND9LYE5VhFZ9zQUqku09dFb4Fbp3/cdYcE49mcNbZ L0/9fHvbdjUXOp2up51NBVHajIG+daJhruc8+NPbY3HBO7Oh2fzsPjm8ZudJefpOQQJy olDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=mhY6UWFYLpGLu9vdotPDgrt7ybIuTPjbMRoJG2CzZUQ=; fh=8XhHqTIBBcYgW8G6v2GcZz7EvmxUshOJ2cBmcE49q8g=; b=ej3vY6cWNg99KNvfHrJsum+5PfwzwELu7o2FgppEBmzUaGNAkccAxMRbNnclCQ3Tze ZjmkubUxkriKsw2NICYDReuharXQJTZc+Cgheb2CDKNMZ4UEiOy74nNeAaX1FMKhavjM gW3VCPcvcLnSW8uCd4jJ6iKIE4pqMKWBLC7vIAFXqQt7Xjgz8Em0xB7Y6hTV1Oct4Clt rYDuCEgmXUK/0lZYT0zh0U67+JxHjN1SPsYbDDJe2ZH6DI/nvXLisSRt2yzvkNyH4AV+ cwq1QySAD4Y+A2r6gRtK660gYgMN3EP2VCeskjMZgjK9QGIWfCkyouBokvSKFz/aO9AL Mh3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=S4+3f3pI; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="u32nqvW/"; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-117951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u2-20020a170902e5c200b001dddb014623si6355162plf.211.2024.03.25.16.54.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 16:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=S4+3f3pI; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="u32nqvW/"; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-117951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A5ECB31BBA for ; Mon, 25 Mar 2024 20:38:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1AD0535DB; Mon, 25 Mar 2024 20:38:48 +0000 (UTC) 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 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 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