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 9A91FC636CD for ; Fri, 10 Feb 2023 06:52:04 +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:To:References:Message-Id:Cc:Date: In-Reply-To:From:Subject:MIME-Version:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i6GraGUvkQAgwJ+scNrU07hD9SfZ6iA9+l/Qv7qLgbc=; b=JmELeQqjZXtunL DrpiUVE1W8hXrCyKH7LiwW3eR8yOc8EZItpynH4Iceepje4U+xUgcQ6Ff+PoNWudoiQWUI43fXXqH AaDsmM43s7kDWW40/m3WCSf96CvFWJFD8LJXzNB98DUHmweR907UD+j/oNqjh/KwOkJjcnHmAsYT8 qDDdDCK0f7oxxQMBregC67Ed6mDDian3JAsp64hjri5RAZWcd1EkHYYvhFpX67Zf0YSTXs7wKQKq7 D4ALWneQtIilHIvdaB4b3gTbofeoEp5DTSkbSBhI1k5ALuR36nON8JFyBZy4lWErQAfEohLWwdHoE JCcOwrDBlovH2YqAOHYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQNFN-004WOD-Vi; Fri, 10 Feb 2023 06:51:02 +0000 Received: from out-106.mta0.migadu.com ([2001:41d0:1004:224b::6a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQNFJ-004WLz-BV for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 06:50:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1676011852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=egqOr1YGGT8jEo/lWpo5ulMjHrekpAj8mKAHNFKoT3Q=; b=YtCQqDiZfnWVNM8XB9yKdmKL8ukWOtRj3ClxpxvnqnMLI/mTXjVv68YNcZLbs5E9d3GeoC gEe7a2LdEjb1U1Jfm7bZ6jbdMLZK13x/DVrYh9vROrP+EHlE87td07M89CU2+qpPVFtvw/ HJc6jCduzlBVwBKc38moYm6+TKQkPn8= MIME-Version: 1.0 Subject: Re: [PATCH V2] arm64/mm: Intercept pfn changes in set_pte_at() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Fri, 10 Feb 2023 14:50:09 +0800 Cc: Will Deacon , Catalin Marinas , Robin Murphy , Anshuman Khandual , linux-arm-kernel@lists.infradead.org, Andrew Morton , linux-kernel@vger.kernel.org, Mark Brown Message-Id: <2B3E64D8-81AD-4DD2-87D8-B8B2AFA97B5A@linux.dev> References: <20230131154950.GB2646@willie-the-truck> <20230203101023.GA5597@willie-the-truck> <93461768-791A-45BE-BEF2-344CC5228C92@linux.dev> <20230207143131.GA12475@willie-the-truck> To: Mark Rutland X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_225057_865589_F92DDB9A X-CRM114-Status: GOOD ( 19.77 ) X-BeenThere: linux-arm-kernel@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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > On Feb 9, 2023, at 01:27, Mark Rutland wrote: > > On Wed, Feb 08, 2023 at 11:13:46AM +0800, Muchun Song wrote: >>> On Feb 7, 2023, at 22:31, Will Deacon wrote: >>> On Mon, Feb 06, 2023 at 11:28:12AM +0800, Muchun Song wrote: >>>> I am not familiar with ARM64, what's the user-visible effect if this >>>> "amalgamation" occurs? >>> >>> The user-visible effects would probably be data corruption and instability, >>> since the amalgamated TLB entry could result in a bogus physical address and >>> bogus permissions. >> >> You mean the output address of amalgamated TLB entry is neither the old >> address (before updated) nor the new address (after updated)? > > Yes, that is one possible result. > >> So it is a bogus physical address? > > Yes, that is one possible result. > >> Is there any specifications to describe the rules of how to create a >> amalgamated TLB entry? Thanks. > > Unfortunately, this is not clearly specified in the ARM ARM, and we have to > take a pessimistic reading here. We assume that amalgamation is some arbitrary > function of the TLB entries which are hit (e.g. they might be OR'd together). > This is something that I'd like to have clarified further by Arm's architects. > > The important thing to note is that amalgamation applies to *TLB entries*, not > the translation table entries that they were derived from. Since the TLB format > is micro-architecture dependent, and since the manner in which they might be > combined is arbitrary, the results of combining could be arbitrary (and > consequently, this is difficult to specify). > > The architecture *does* provide a few restrictions (e.g. Stage-1 entries within > a VM can't escape Stage-2, NS entries can't create a secure physical address), > but beyond that we cannot make any assumptions. > > So e.g. if you have 2 read-only entries for addresses A and B, amalgamation > could result in read-write-execute for a distinct address C. > > It's not clear to me whether that could also affect hits for unrelated VAs. > > So the short answer is that we have to treat this as CONSTRAINED UNPREDICTABLE, > and must avoid potential amalgamation by using Break-Before-Make. Thanks for your clear description. It's really helpful. > > Thanks, > Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel