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 53255C4332F for ; Tue, 22 Nov 2022 08:14:40 +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:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vW3Ne8pKIWmThN1mJP25mYkicFV2zXzaXDBrb1m73sc=; b=LWft9kcpWI9oUW VHFVAyBY663kUc/7Ni5uz2dI2ppQIQqAv4thJl965hvWHIbqYGDxAEFcOAjkWDLeXkZDT8IMzSxsl ZVHlN1xX7ZlE33ykCurq34Xon/bRCOpBSJGqkGY4+OE4v/ebLnXmI6OVJOi4xy7zFJC2AzvWeqQFo 1u31w0f59b6ruwaJ+opzSL6o8pPge9VTg3yofV4Tji3mFaCn7JqdpCYdxJITEaYh+G0InvYZhRfXV CkBh1dLeSK4c5qlXGwQ/3gtXJi/Ao7lNs+aMfZjhGehaSc9Ma2i/IoKVcW1FEsk9HXiYE9UxjdUKY MMYe3IvFShVZ1gEvvbXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxOPR-0067h2-67; Tue, 22 Nov 2022 08:13:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxOPJ-0067ZU-MV for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2022 08:13:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC6F01FB; Tue, 22 Nov 2022 00:13:28 -0800 (PST) Received: from [10.162.40.16] (unknown [10.162.40.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 636BE3F73D; Tue, 22 Nov 2022 00:13:20 -0800 (PST) Message-ID: <879e561c-e834-196c-b9c5-6e44ac2c0296@arm.com> Date: Tue, 22 Nov 2022 13:43:17 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] arm64/mm: Intercept pfn changes in set_pte_at() Content-Language: en-US To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, Mark Rutland , Andrew Morton , linux-kernel@vger.kernel.org References: <20221116031001.292236-1-anshuman.khandual@arm.com> <20221118141317.GF4046@willie-the-truck> From: Anshuman Khandual In-Reply-To: <20221118141317.GF4046@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221122_001329_807197_3674CCB3 X-CRM114-Status: GOOD ( 15.87 ) 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 11/18/22 19:43, Will Deacon wrote: > On Wed, Nov 16, 2022 at 08:40:01AM +0530, Anshuman Khandual wrote: >> Changing pfn on a user page table mapped entry, without first going through >> break-before-make (BBM) procedure is unsafe. This just updates set_pte_at() >> to intercept such changes, via an updated pgattr_change_is_safe(). This new >> check happens via __check_racy_pte_update(), which has now been renamed as >> __check_safe_pte_update(). >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: Andrew Morton >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> This applies on v6.1-rc4 >> >> arch/arm64/include/asm/pgtable.h | 8 ++++++-- >> arch/arm64/mm/mmu.c | 8 +++++++- >> 2 files changed, 13 insertions(+), 3 deletions(-) > > I remember Mark saying that BBM is sometimes violated by the core code in > cases where the pte isn't actually part of a live pgtable (e.g. if it's on > the stack or part of a newly allocated table). Won't that cause false > positives here? Could you please elaborate ? If the pte is not on a live page table, then pte_valid() will return negative on such entries. So any update there will be safe. I am wondering, how this change will cause false positives which would not have been possible earlier. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel