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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D320C433F5 for ; Mon, 25 Oct 2021 16:59:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 359D360F92 for ; Mon, 25 Oct 2021 16:59:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234156AbhJYRCF (ORCPT ); Mon, 25 Oct 2021 13:02:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:54340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234151AbhJYRCE (ORCPT ); Mon, 25 Oct 2021 13:02:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EA52603E7; Mon, 25 Oct 2021 16:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635181182; bh=6H8hFO/A50Azi8V/YTYPHUkKtU198WHr2HkH2FB4dJ8=; h=From:To:Cc:Subject:Date:From; b=at0I9LQPIRsFknc8V8zeTsmdJgyDOGhJDI9zNar1FvwaeGdqCj3IqO/YDIJSSC/vl 0gRmaWNKMYrpPBJZNoYPa2Ax5Do6k05X9JBlF8piOEh5GU+JPU5jYBzSk0iRBLIz4Q geG2t5wAKTVLaiKb5/BTuXg9V3tKJQczI0FwisCKC5r7z9Pd+qvfU4Nv9QzOrI/XGe BXm8YsDSPy697A/8E5PqnzH69iREzBXDBZBWJFpcemcU2rEtqhxWvO5awMapr86K/O NJOo4eRQN2uwsuU+vLWNQ9R9x7ZCrJRayjFWeK9UbH7iPdBxfRY2BDqOJYb5SpWxfX Tl+w+BaRTkxYQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Quentin Perret , Will Deacon , Marc Zyngier , Sasha Levin , catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH AUTOSEL 5.14 01/18] KVM: arm64: Report corrupted refcount at EL2 Date: Mon, 25 Oct 2021 12:59:14 -0400 Message-Id: <20211025165939.1393655-1-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quentin Perret [ Upstream commit 7615c2a514788559c6684234b8fc27f3a843c2c6 ] Some of the refcount manipulation helpers used at EL2 are instrumented to catch a corrupted state, but not all of them are treated equally. Let's make things more consistent by instrumenting hyp_page_ref_dec_and_test() as well. Acked-by: Will Deacon Suggested-by: Will Deacon Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20211005090155.734578-6-qperret@google.com Signed-off-by: Sasha Levin --- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c index 41fc25bdfb34..da2d3c0bfb7f 100644 --- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c +++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c @@ -152,6 +152,7 @@ static inline void hyp_page_ref_inc(struct hyp_page *p) static inline int hyp_page_ref_dec_and_test(struct hyp_page *p) { + BUG_ON(!p->refcount); p->refcount--; return (p->refcount == 0); } -- 2.33.0 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 087DFC433F5 for ; Mon, 25 Oct 2021 16:59:49 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 7B32260F9B for ; Mon, 25 Oct 2021 16:59:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B32260F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 04ECF4B129; Mon, 25 Oct 2021 12:59:48 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mkgdh153xTsz; Mon, 25 Oct 2021 12:59:46 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5BEAE4B135; Mon, 25 Oct 2021 12:59:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C88234B08D for ; Mon, 25 Oct 2021 12:59:44 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nDHRGvytmY0Y for ; Mon, 25 Oct 2021 12:59:43 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 18E074B129 for ; Mon, 25 Oct 2021 12:59:43 -0400 (EDT) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EA52603E7; Mon, 25 Oct 2021 16:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635181182; bh=6H8hFO/A50Azi8V/YTYPHUkKtU198WHr2HkH2FB4dJ8=; h=From:To:Cc:Subject:Date:From; b=at0I9LQPIRsFknc8V8zeTsmdJgyDOGhJDI9zNar1FvwaeGdqCj3IqO/YDIJSSC/vl 0gRmaWNKMYrpPBJZNoYPa2Ax5Do6k05X9JBlF8piOEh5GU+JPU5jYBzSk0iRBLIz4Q geG2t5wAKTVLaiKb5/BTuXg9V3tKJQczI0FwisCKC5r7z9Pd+qvfU4Nv9QzOrI/XGe BXm8YsDSPy697A/8E5PqnzH69iREzBXDBZBWJFpcemcU2rEtqhxWvO5awMapr86K/O NJOo4eRQN2uwsuU+vLWNQ9R9x7ZCrJRayjFWeK9UbH7iPdBxfRY2BDqOJYb5SpWxfX Tl+w+BaRTkxYQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 01/18] KVM: arm64: Report corrupted refcount at EL2 Date: Mon, 25 Oct 2021 12:59:14 -0400 Message-Id: <20211025165939.1393655-1-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Cc: Sasha Levin , Marc Zyngier , catalin.marinas@arm.com, Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu From: Quentin Perret [ Upstream commit 7615c2a514788559c6684234b8fc27f3a843c2c6 ] Some of the refcount manipulation helpers used at EL2 are instrumented to catch a corrupted state, but not all of them are treated equally. Let's make things more consistent by instrumenting hyp_page_ref_dec_and_test() as well. Acked-by: Will Deacon Suggested-by: Will Deacon Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20211005090155.734578-6-qperret@google.com Signed-off-by: Sasha Levin --- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c index 41fc25bdfb34..da2d3c0bfb7f 100644 --- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c +++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c @@ -152,6 +152,7 @@ static inline void hyp_page_ref_inc(struct hyp_page *p) static inline int hyp_page_ref_dec_and_test(struct hyp_page *p) { + BUG_ON(!p->refcount); p->refcount--; return (p->refcount == 0); } -- 2.33.0 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E51BC433FE for ; Mon, 25 Oct 2021 17:01:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 124776108D for ; Mon, 25 Oct 2021 17:01:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 124776108D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DcaPgAEzlCBjYrOg/xeFSh8nGPqdwHr3SpMupSaNKAs=; b=ldWHY/gvBMBk3f O33CDKObbUNdtCMfxuffcnsnyzr5sYZFOOZr70czDilMbIOx5KMOxjdS2QAh7T5qVzqG64NgduuD1 0KcHwNpNMPGVWWHWuqTqQ0kd3DWtghoYpdWGvVYcQff55u3R6FiNuy1y6JvfwzztpypVctygSn+Da w/hGrMdKhsojG+3f6g2Bhh3c/PwXn8dLzpdNQGTzBYiBeHwE2m/z1OkPc24cXDHbleiRpKLE4XcLp 2UDr7xORncMlSJiY1cJqK91QwitZSiWU4LM201C3ClvVukYTHEtqS43NrhLBQwi7vPaWBvd7QSKW9 LkSVvC6Jo+CSB0xHL5Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf3K7-00H8DW-Ae; Mon, 25 Oct 2021 16:59:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf3K2-00H8Cd-Us for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 16:59:44 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EA52603E7; Mon, 25 Oct 2021 16:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635181182; bh=6H8hFO/A50Azi8V/YTYPHUkKtU198WHr2HkH2FB4dJ8=; h=From:To:Cc:Subject:Date:From; b=at0I9LQPIRsFknc8V8zeTsmdJgyDOGhJDI9zNar1FvwaeGdqCj3IqO/YDIJSSC/vl 0gRmaWNKMYrpPBJZNoYPa2Ax5Do6k05X9JBlF8piOEh5GU+JPU5jYBzSk0iRBLIz4Q geG2t5wAKTVLaiKb5/BTuXg9V3tKJQczI0FwisCKC5r7z9Pd+qvfU4Nv9QzOrI/XGe BXm8YsDSPy697A/8E5PqnzH69iREzBXDBZBWJFpcemcU2rEtqhxWvO5awMapr86K/O NJOo4eRQN2uwsuU+vLWNQ9R9x7ZCrJRayjFWeK9UbH7iPdBxfRY2BDqOJYb5SpWxfX Tl+w+BaRTkxYQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Quentin Perret , Will Deacon , Marc Zyngier , Sasha Levin , catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH AUTOSEL 5.14 01/18] KVM: arm64: Report corrupted refcount at EL2 Date: Mon, 25 Oct 2021 12:59:14 -0400 Message-Id: <20211025165939.1393655-1-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_095943_040927_D419C327 X-CRM114-Status: UNSURE ( 6.98 ) X-CRM114-Notice: Please train this message. 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 From: Quentin Perret [ Upstream commit 7615c2a514788559c6684234b8fc27f3a843c2c6 ] Some of the refcount manipulation helpers used at EL2 are instrumented to catch a corrupted state, but not all of them are treated equally. Let's make things more consistent by instrumenting hyp_page_ref_dec_and_test() as well. Acked-by: Will Deacon Suggested-by: Will Deacon Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20211005090155.734578-6-qperret@google.com Signed-off-by: Sasha Levin --- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c index 41fc25bdfb34..da2d3c0bfb7f 100644 --- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c +++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c @@ -152,6 +152,7 @@ static inline void hyp_page_ref_inc(struct hyp_page *p) static inline int hyp_page_ref_dec_and_test(struct hyp_page *p) { + BUG_ON(!p->refcount); p->refcount--; return (p->refcount == 0); } -- 2.33.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel