Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp378359pxb; Mon, 25 Oct 2021 10:02:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy34Rv25IyRtjrt5UdxF2E/C4x1p6as7UFNP7w8DJ0zszhjtM9Xa+P64dz7mXIGMhwpDfor X-Received: by 2002:a17:906:f189:: with SMTP id gs9mr21013327ejb.248.1635181335170; Mon, 25 Oct 2021 10:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635181335; cv=none; d=google.com; s=arc-20160816; b=QkWN3W57AMVKvS9uuq9CD58ErnU08Bs02WZFp8N8mxqMulpG6COi2xnW64abb/lihU tAMuH02BKEN1L9Cw3Portlj2fuFHEu1K2u1icjm83g9q5edojy0mioA2Z9nIf/0/qq77 1vKegC6whhQyZ9IcD5IlIaL3g6wt7ZJ4EZkVL9uvrJfC1bWcGo3aoGf4KdsRqxsR95/O mlzAQvTgwEP2dGd0DNgnE4KSwRNhkYgSemdLm4WLtAr7sDReWnok6UxFQXI8ZqVVCBYw dIHLaYWm39+wJRl5l6yM3rq0LpLgrXQuuPAyrEwyarQxSBqYwtWX9PVUzhxVAkkCJm1c 2A/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Ou7YxjfwoukgSO5YM9bt+NNMYapteY4jIXpx24RGmJU=; b=nLxKU9PcqoGFfjeKWFsJI20MZkZmtdmT6vfMo8QFToHC2UcbsrJ9F3+mxY+7oiacka 7sqOCW0VAjnXrCoz/QAaC0iini81wl5OSVlYFURCHN9SpiUa4RllalAckdBvgach9XHw Ktuu1b9cXsns7tt9vP4yMh/Yqp4tKIHg47lytSsLJ/us9sGl/EXKkXBA83dNdx72kCtP s91CcmDGQoLMD6PYh+Qa+bqlAKnAp/vpabsWne2d5YROuQX1UcHUFgwKa5X14JHDBGLL Yjaa9xLCg2N+q1GcoKsiLkEKwUWNSHDQu6vOQtC43Yz+OXnGg4/BifO6TOnYdeIBSqtl pwsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=at0I9LQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq17si2491484ejc.89.2021.10.25.10.01.44; Mon, 25 Oct 2021 10:02:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=at0I9LQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234148AbhJYRCF (ORCPT + 99 others); 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