From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFFA6C47DD9 for ; Sun, 24 Mar 2024 22:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Date:References: In-Reply-To:Message-Id:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TS86UIZus7xgcnuv+20BEHCmpV9fQaRsH+9rtcpeqn4=; b=DQJ07C18rq1cgr MNy/l+kGVMoxrj1hrpj8Hwfl8RwtUBZbbhstmccYBqgEewkCus+O8rofd78P/c/TwaF/iw/L04bZF 0xVuKDWKYYvkjne/+pmmCxdauaPkFb2gSGbDOACymsNzzk1XB1rUYLRFSIwyynROKd+ta6hXDsN5o 8KyEVE8LR9M2m841daCEKLyZW4Gokj9E00VHPt7EAqL266IVCSox8UtEnSX2/85k/2sEB4WVAkjfV yksrOKBA4itD+J8kq/AeaL7iza+pix3Cd8GcIPQ3AoPSBUqKaiDEgnEekNTtOrcNUNK00wl/nvxHe fmvyLfb2FwJqtf8dMesg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1roVz1-0000000DYe8-0TP7; Sun, 24 Mar 2024 22:06:27 +0000 Received: from wfhigh1-smtp.messagingengine.com ([64.147.123.152]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1roVyx-0000000DYd5-2B7d for linux-riscv@lists.infradead.org; Sun, 24 Mar 2024 22:06:25 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 6B2221800089; Sun, 24 Mar 2024 18:06:14 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Sun, 24 Mar 2024 18:06:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding: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=1711317973; x=1711404373; bh=GRJdMDLcsCv605YDty6b0aLIc6c6sh50+KXqZZugJ/I=; b= ExwTFkCOFpIo38KY7iJTosSFyXZAOHlKjwtxVcy1uBg+lHq5z7viRERmRyORuZHc J7rfXpEJb7+tkkUhPScyQ5jBPF1C1yHaDIFmucrqsPkL6O3sW2sR+rQ/h7sKrVbl XcAa9z3ReV1LMAspEwmUFwGy8taTCtcwICz1s7MnUB1NZPJNsK/iWoG43iImsjh2 Iz3D25ulblIYetZhPHIE2Q5Mnkb/iS1sg56twYE8i5a9148aB+LCtAIVUq10O8nr o1pyALAQlaToMrmVK/b3IgarpWhY8/F/Zoj9GLXWg/nuC8G8ZinXPEDNbhGy+BXb fVZDDqPmckEmwoqx3JrwMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1711317973; x= 1711404373; bh=GRJdMDLcsCv605YDty6b0aLIc6c6sh50+KXqZZugJ/I=; b=d 3ta/uNLxM2d/dUh5PPLdRhACAzMKKtdvv8yUG0NX1RIPTovWNJSBu9myOqusORUG NaiyR50yKBMBMQKRi05keIU1vbbFDTVZ3Z+12esJyOQnIyQzvIQfvX7eEvLOEIYa PH3XMUICS43foQFAaVyfCo7O9gDBP9YsDneIqtTWDHrcuHiEfACea7pSWYg637/P Ia/hpR6WKRIMv3+U+ewhAE9VI7VZCGZ5+F4JZMAE+zSW85DjOQlh/kiw1eRFHE3x y+eR3dTJQyCcwSSTKxbDu2GBHGYGRdnXgrY1GI+4Q6estGI0aDUQUxdq2TULoNgI mSH/3AZAtoSzrvMv8eUGw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtjedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf tehrnhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrf grthhtvghrnhepfffhvdejieelteeljeekgeegieevheelueehieehkeehgeekhfdtleek teevtefgnecuffhomhgrihhnpegsohhothhlihhnrdgtohhmnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 97D01B6008D; Sun, 24 Mar 2024 18:06:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-332-gdeb4194079-fm-20240319.002-gdeb41940 MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20240313180010.295747-1-samuel.holland@sifive.com> <88de4a1a-047e-4be9-b5b0-3e53434dc022@sifive.com> Date: Sun, 24 Mar 2024 23:05:52 +0100 From: "Arnd Bergmann" To: "Alexandre Ghiti" , "Samuel Holland" , "Alexandre Ghiti" Cc: "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() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240324_150623_793473_0357E147 X-CRM114-Status: GOOD ( 18.36 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org T24gVHVlLCBNYXIgMTksIDIwMjQsIGF0IDE3OjUxLCBBbGV4YW5kcmUgR2hpdGkgd3JvdGU6Cj4g T24gMTgvMDMvMjAyNCAyMjoyOSwgU2FtdWVsIEhvbGxhbmQgd3JvdGU6Cj4+IE9uIDIwMjQtMDMt MTggMzo1MCBQTSwgQWxleGFuZHJlIEdoaXRpIHdyb3RlOgo+Pj4gT24gV2VkLCBNYXIgMTMsIDIw MjQgYXQgNzowMOKAr1BNIFNhbXVlbCBIb2xsYW5kCj4+IEl0IGxvb2tzIGxpa2UgdGhlIGNhbGwg dG8gZml4dXBfZXhjZXB0aW9uKCkgW2FkZGVkCj4+IGluIDQxNjcyMWZmMDVmZCAoInJpc2N2LCBt bTogUGVyZm9ybSBCUEYgZXhoYW5kbGVyIGZpeHVwIG9uIHBhZ2UgZmF1bHQiKV0gaXMKPj4gb25s eSBpbnRlbmRlZCB0byBjYXRjaCBudWxsIHBvaW50ZXIgZGVyZWZlcmVuY2VzLiBTbyBtYWtpbmcg dGhlIG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GEgYmV0dGVyIHBsYWNlIHRvCnN0YXJ0IG9wdGltaXppbmcsIHNp bmNlIHRoaXMgcmFyZWx5IG5lZWRzIHRvIGJlIHNlbGVjdGVkCmR5bmFtaWNhbGx5LgoKICAgICAg QXJuZAoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlu dXgtcmlzY3YgbWFpbGluZyBsaXN0CmxpbnV4LXJpc2N2QGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0 cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5mby9saW51eC1yaXNjdgo= From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wfhigh1-smtp.messagingengine.com (wfhigh1-smtp.messagingengine.com [64.147.123.152]) (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 BD7CC1CD02 for ; Sun, 24 Mar 2024 22:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711317978; cv=none; b=WUZ8kwPpCtbl3JkDi6umHdhfU7t2dYY91B+mMmlEz07i/1pgfJ1/dRHTlrcXFOdF6ouRbW+kknvNwO9zs+pyiw+4zIbWPB5uSwqwqT0ejHoi5OSrwZQ7exow+PfwWLQRpx3HlMvkDmWlkWdaLA4KHlK2GCsVrjnj1/G22nqS7w0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711317978; c=relaxed/simple; bh=WgvpP+iZAziEU6XyEImoxV4uJq9sct88omD3j9dILXc=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=u8wxvQLe/AkLDdJLQyOJEt1dFvM4uJt0XOTb4VjOTBs+kttL0SDflZfRwkj+HLdJlAHrEIHV2iWyNrPSy4K/HYVCdBjiQlzlhIiDuiPPHvNYF3yEf3/X1QEPKOrogg7YIfszStIMXGBktTYmzAAvwgM1/9KF4dN5qSZtdJ1NjF4= 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=ExwTFkCO; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=d3ta/uNL; arc=none smtp.client-ip=64.147.123.152 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="ExwTFkCO"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="d3ta/uNL" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 6B2221800089; Sun, 24 Mar 2024 18:06:14 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Sun, 24 Mar 2024 18:06:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding: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=1711317973; x=1711404373; bh=GRJdMDLcsCv605YDty6b0aLIc6c6sh50+KXqZZugJ/I=; b= ExwTFkCOFpIo38KY7iJTosSFyXZAOHlKjwtxVcy1uBg+lHq5z7viRERmRyORuZHc J7rfXpEJb7+tkkUhPScyQ5jBPF1C1yHaDIFmucrqsPkL6O3sW2sR+rQ/h7sKrVbl XcAa9z3ReV1LMAspEwmUFwGy8taTCtcwICz1s7MnUB1NZPJNsK/iWoG43iImsjh2 Iz3D25ulblIYetZhPHIE2Q5Mnkb/iS1sg56twYE8i5a9148aB+LCtAIVUq10O8nr o1pyALAQlaToMrmVK/b3IgarpWhY8/F/Zoj9GLXWg/nuC8G8ZinXPEDNbhGy+BXb fVZDDqPmckEmwoqx3JrwMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1711317973; x= 1711404373; bh=GRJdMDLcsCv605YDty6b0aLIc6c6sh50+KXqZZugJ/I=; b=d 3ta/uNLxM2d/dUh5PPLdRhACAzMKKtdvv8yUG0NX1RIPTovWNJSBu9myOqusORUG NaiyR50yKBMBMQKRi05keIU1vbbFDTVZ3Z+12esJyOQnIyQzvIQfvX7eEvLOEIYa PH3XMUICS43foQFAaVyfCo7O9gDBP9YsDneIqtTWDHrcuHiEfACea7pSWYg637/P Ia/hpR6WKRIMv3+U+ewhAE9VI7VZCGZ5+F4JZMAE+zSW85DjOQlh/kiw1eRFHE3x y+eR3dTJQyCcwSSTKxbDu2GBHGYGRdnXgrY1GI+4Q6estGI0aDUQUxdq2TULoNgI mSH/3AZAtoSzrvMv8eUGw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtjedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedf tehrnhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrf grthhtvghrnhepfffhvdejieelteeljeekgeegieevheelueehieehkeehgeekhfdtleek teevtefgnecuffhomhgrihhnpegsohhothhlihhnrdgtohhmnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 97D01B6008D; Sun, 24 Mar 2024 18:06:12 -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: In-Reply-To: References: <20240313180010.295747-1-samuel.holland@sifive.com> <88de4a1a-047e-4be9-b5b0-3e53434dc022@sifive.com> Date: Sun, 24 Mar 2024 23:05:52 +0100 From: "Arnd Bergmann" To: "Alexandre Ghiti" , "Samuel Holland" , "Alexandre Ghiti" Cc: "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;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 19, 2024, at 17:51, Alexandre Ghiti wrote: > On 18/03/2024 22:29, Samuel Holland wrote: >> On 2024-03-18 3:50 PM, Alexandre Ghiti wrote: >>> On Wed, Mar 13, 2024 at 7:00=E2=80=AFPM Samuel Holland >> It looks like the call to fixup_exception() [added >> in 416721ff05fd ("riscv, mm: Perform BPF exhandler fixup on page faul= t")] is >> only intended to catch null pointer dereferences. So making the chang= e wouldn't >> have any functional impact, but it would still be a valid optimizatio= n. >> >>> Or I was wondering if it would not be better to do like x86 and use = an >>> alternative, it would be more correct (even though I believe your >>> solution works) >>> https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/= page_64.h#L82. >> What would be the benefit of using an alternative? Any access to an a= ddress >> between TASK_SIZE and TASK_SIZE_MAX is guaranteed to generate a page = fault, so >> the only benefit I see is returning -EFAULT slightly faster at the co= st of >> applying a few hundred alternatives at boot. But it's possible I'm mi= ssing >> something. > > > The use of alternatives allows to return right away if the buffer is=20 > beyond the usable user address space, and it's not just "slightly=20 > faster" for some cases (a very large buffer with only a few bytes bein= g=20 > beyond the limit or someone could fault-in all the user pages and fail=20 > very late...etc). access_ok() is here to guarantee that such situation= s=20 > don't happen, so actually it makes more sense to use an alternative to=20 > avoid that. The access_ok() function really wants a compile-time constant value for TASK_SIZE_MAX so it can do constant folding for repeated calls inside of one function, so for configurations with a boot-time selected TASK_SIZE_64 it's already not ideal, with or without alternatives. If I read the current code correctly, riscv doesn't even have a way to build with a compile-time selected VA_BITS/PGDIR_SIZE, which is probably a better place to start optimizing, since this rarely needs to be selected dynamically. Arnd