Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2939278lqp; Mon, 25 Mar 2024 13:49:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkzLlZWdhjuFB0YX0YxF4tqCh97lzMQC/piBX7STFoERBVg9+Wt6pgxMT0KZzbz1r6LpB/TjYTduhLE8Pjcd9afvxJBcZqr1phj3xWSg== X-Google-Smtp-Source: AGHT+IEDd7fjr4MHiSxfqSazWBdpZPSNuIQ4Q40bRFTm8lTJIEd4xugHEEXSsR2pF5IiJz5R+4CY X-Received: by 2002:a05:6359:4111:b0:17b:8706:fd39 with SMTP id kh17-20020a056359411100b0017b8706fd39mr10315536rwc.10.1711399751232; Mon, 25 Mar 2024 13:49:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711399751; cv=pass; d=google.com; s=arc-20160816; b=vHRjijsmjaOrUaO0iQWQ5qcSUFgTd6lDX9LCkRzGuUDhIWwbs0bmBD3eekht2VwqQs 4qam3QEhinTNTNSMOOTQOjEJPW2hzrNWRPI02WTTIn8uT+7hMLmomSSzm/QKVtUW/Yy2 vKz2Cj+9/rU3BNFh/PpuupDbsL0YJsiG7Gh8hOEt0f68A5JtKVd7i+pwBGNq+5NzejAJ TeXaQs+PJ8Iu10ArFO9EjnaUN6frPP1U0aDCOnfODKmGBCeh3cPnJEsZos4a+OLCHed3 aSXaL9UTnUzOYBxt8icKsIxJHH5fDr4s8FgXKj4SG++V+XWlZJvN1zy06BtVv9bY6DKf FmFg== 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=lC0QogFDJsdPPHPVxEtk7oE0Tzlwl0ZdsUXHw0ePYwM=; fh=hv1cB9ygTWvZCHK5Q9uuF0ZhjaXLzRTUeP1Njw0uykU=; b=JzG5iRMHr+5yWAa01mVzLqZa18p6xTkbjTZc8zL+MRLGbVEfflceT7/gq9/Kd/JIkm Yye+brNBpRQd+0Li/Jx6XaxZVlKz9Kx3M0So2uMYClTxT88+gf/s2xC/w40y+LlO61x1 b4JXGMLgBwLnvgma9vkdeJzZw+PC7YiS/Nq9qWtTX4iQ+8V579Y+58eeSa+eUSdxptrm nAZ12kuw9vyPH3AX5nGzgqdbCtAMUb+tqHrIqYt1JIrwtxhjVR2UFSIsaCarWthbSN5J AtzTXF92qOA/jWaIi0n82QrvkIDOS0LkQLzZhc15uDF6RGEwmYtBwuDaMQbc5G0Y+iFm bBIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=bvwN+wT9; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=wqgZ83aW; 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-117954-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d4-20020a63f244000000b005f057f38dcbsi3411519pgk.455.2024.03.25.13.49.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 13:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117954-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=bvwN+wT9; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=wqgZ83aW; 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-117954-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117954-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E7FD23235B7 for ; Mon, 25 Mar 2024 20:41:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1338D59B61; Mon, 25 Mar 2024 20:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="bvwN+wT9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="wqgZ83aW" Received: from wfout8-smtp.messagingengine.com (wfout8-smtp.messagingengine.com [64.147.123.151]) (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 CC564524B4 for ; Mon, 25 Mar 2024 20:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399268; cv=none; b=g62tJGDZJsQ3I9jrsUUmP58Lp25mrthTvjOzhv7NLoAZ1CNzWAHbAj/UW4NlHk1iFvUQ0IOTZXDy0pWOVfix92pXtTJyBj/dtVYyvbFr8l3cqJXSpKgFB8mQ8z3HH91MYCNov52Uq7/EHAMDOjsSdjIlZW5+hXnF/l1G3+Ppz3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399268; c=relaxed/simple; bh=TISnD2Sz6h06YodRH0dcBihqS+tmwi7dCNb4AfyBevs=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=VzU0goYK3XonQPHD//w/gNK18kZDGbUpkanNgy6hqy9i4ZQyV1a1AW0GQ3Z04DY43FPEa90wAUYenRrAWgyGYUrA/4aRw0xn584OmmNTBt7Xd5Jcwz022vzqclVuHJVgpBFJ6AO29i1FacJ7Y8+LjdpGP+Y4YM+A82rDleI7oQg= 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=bvwN+wT9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=wqgZ83aW; arc=none smtp.client-ip=64.147.123.151 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 mailfout.west.internal (Postfix) with ESMTP id 97DA51C000D0; Mon, 25 Mar 2024 16:41:02 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 25 Mar 2024 16:41:04 -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=1711399262; x=1711485662; bh=lC0QogFDJs dPPHPVxEtk7oE0Tzlwl0ZdsUXHw0ePYwM=; b=bvwN+wT98TadP1KmewjIVddLCI iUNQb5KjKmtYbcUmymAdSGVXcrq0cnuImEWElkUv8aQiFjIaqbruybE15UCMyyug 9GwAxVztn5vvIWoFl4hcyJ72HxzwEfJif16dMv+UdUpcAHn2Sl823mcNzFnPLCqb W6pBXwWCwmhBnhdtvou8R8IkHvT7aLLuCOXYMJKpMfe0T7hPQrzYK2TaKsFk/OVm IPkwrdhgrMBn+urySP2jZ694YjgOMBqcC8zf2zU46M2eLTnYnsPuL+3dLepsBNwR 7p0ecAvjpu8l+3nD4bMcMJ9CAlHAj638U2nyx249rWSFiyfG+xCKtj/e5pfg== 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=1711399262; x=1711485662; bh=lC0QogFDJsdPPHPVxEtk7oE0Tzlw l0ZdsUXHw0ePYwM=; b=wqgZ83aWPxyDI+wzSX9U0KrHrNq97/i29O1o9sx1Jful 1WwnQDRqrmejTxMpPI/nBoKTimsqS0+Ylkzr0OWPOmM+kr4XSFmZzsBYYzB0wlYP gjyRYxnNTSwE5rmegRcU2ECy0PE7fSDdX4HIFckt1HtNR+EiH6B9AfBnkxb+NOGX 8bPfYyBKC4ZcfzpuGBx2QWNzEo+THzMlGdiIGKztniiPqf1SzJkU63+6lLtMjPSd P0ed2ok+4DLA34Dl9jhf5MDPd+MIIGxih8KNmkyaUaxFrlPORy6FyaPyXTOAZe6q 8fV9ewX2gIfPQ8Hy2kNKNj1kfVaiewsio75arZVSEg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduuddgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8D90DB6008D; Mon, 25 Mar 2024 16:41:01 -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: <3ac65601-7102-4ad1-ad89-157f7d9cef87@app.fastmail.com> In-Reply-To: <20240313180010.295747-1-samuel.holland@sifive.com> References: <20240313180010.295747-1-samuel.holland@sifive.com> Date: Mon, 25 Mar 2024 21:40:41 +0100 From: "Arnd Bergmann" To: "Samuel Holland" , "Palmer Dabbelt" , linux-riscv@lists.infradead.org Cc: "Albert Ou" , "Alexandre Ghiti" , "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 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 Reviewed-by: Arnd Bergmann > #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