From patchwork Mon Dec 4 14:03:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 120538 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4472403qgn; Mon, 4 Dec 2017 06:03:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMag/ZhnLLep5b6om8O2OwFgA1UViei1Yjy8NVolbiA4fwTKxBI4MBQ6Q9zxQsKjmcQwEqlE X-Received: by 10.99.174.1 with SMTP id q1mr14011402pgf.434.1512396238206; Mon, 04 Dec 2017 06:03:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512396238; cv=none; d=google.com; s=arc-20160816; b=SgBnLGyJDT50wH4q7mkPH2h6dks98ocnZRzPNghzpPR55zqRY6OO6poP9OPsfLqfOg 3kfofFkPQGlRnIdlnH2DpeN2tfmN5DBXpXwfkKEWoJZ8BhAmRqXocxwbQMYB8gC+USfc H0ciGal7xTPxPe4ZWpfI8EmlSV65VQD1Aaw3UXkfrYYlX7qufM+YPjKMJuG02WZB3XRp jmldnbTMvm4Cv7XU+6PVy6mTUXchp601QnmYrQurLXN3DGxiGVOOjT7w1LASiRwQxmTT qe54EP6MX+mWvmd3rtRZQjnbq5KYa+WoTqZMb6fX3YWPj9y5jD6IkW3W8+UA8l6zHKK9 GZlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TmaNMu0M7k204C0NDi+s40IgEK6nif15+A5iZT2a8Jc=; b=jrfVKL1i9Oc5Y6qA2YD+l5eZ5Z3kU43l13mdXdrza7sAew0xlDGSDijFSbeAziVVi0 D1e+qecqMFrWxnOEAeRpzZEAjmIhMGiELmLHB3OvQKV7l45T45bAmpordoD25yMdbQ0y mzopeHdJ6M0h1g/xEl4bQ1tnByqBKWmlo9BKhxNDxKSkIm4aXv9+lZ9i4N638uh5V3RY HcAcsx+vFNZ0olAy8Dp2qNnK/OIL5ZDu5jQb1Dk8cGiU7w9oTRMPvBzOy8YehGDasMwJ aG0tUu+7OsBAJVQz3ddHxWuYKBNFFXvX/qq4qnMQ0E5SgE7Yc0DJkvkQ9/P2ilTLM2dE wLRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=gqo/phH7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g31si5138782pld.67.2017.12.04.06.03.58; Mon, 04 Dec 2017 06:03:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=gqo/phH7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754305AbdLDOD5 (ORCPT + 9 others); Mon, 4 Dec 2017 09:03:57 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37376 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094AbdLDODy (ORCPT ); Mon, 4 Dec 2017 09:03:54 -0500 Received: by mail-wm0-f65.google.com with SMTP id f140so14474032wmd.2 for ; Mon, 04 Dec 2017 06:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=TmaNMu0M7k204C0NDi+s40IgEK6nif15+A5iZT2a8Jc=; b=gqo/phH77XEQ6AxcaOPptrlizc0DPPBJZs1/QRrK5d/7p++f/MNZl35eyEG+Uy5k+2 thkRZFXjoakJgXq14hhIbNHGv5465Jkypvanpvm4sC5Ul/cSS92XryoW9Qlt7IErAicv sQsYe9SwJbs+3UDhE03njBVDHf2GXu7x/d7fZjO63jmUFG8EbaHJ/hKbpLoLkQyGtaRx HlSqtupbOmTXpQkuWq++kN8j7hnlmooJ3G8tbUkhqGOjxX+kOxxM0at2qe73bwsSHzge xcL0eG/dDodaMCZdObyJrc7L84tWJ8ttE+uvvAjBVNuPAzoW17akR8/NmhzVMjCd+o4r Vsjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=TmaNMu0M7k204C0NDi+s40IgEK6nif15+A5iZT2a8Jc=; b=V4YxskgPiqH1X6CtDqbrkD2nczpg/T9Mr0KEuOoA8qhu6uMHHGWPylaVnc2pkSHRuk gHoP7ffS/ebRMtQRH2v8SFjLYAP92Xiu9hCD9MMtCCO0weZGIRnt18KtPR2vBVTuTbz9 VdOICF9g6df3TYl69rXeaoypVXzLyemPUUklAp7LMKDHWlIkJO4BklOo+NjuHKC0iw9b GNukuMgmUpm6vkEuJxw9p6WCcBvChBzWcVqC0YZUK12RqRgWoMOeoWuACsf8JGqYOiNc bbG7iIqSEMBe8n8j3HEXXfG8N/qjjQkHDc/p837MBeg1Wk2/tjJ8XGXu8ZnO01iEAYWg cBJA== X-Gm-Message-State: AKGB3mKcWt2tyBT7+rm/6Om0WmjFOJBN73vd365leoBVEtoqLGgv3/Tc RlP+FUxKRMxLF+b2983pqfpqXw== X-Received: by 10.28.66.148 with SMTP id k20mr3507437wmi.40.1512396233015; Mon, 04 Dec 2017 06:03:53 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:03:52 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , stable@vger.kernel.org, Christoffer Dall Subject: [PULL 04/19] KVM: arm/arm64: vgic: Preserve the revious read from the pending table Date: Mon, 4 Dec 2017 15:03:33 +0100 Message-Id: <20171204140348.21965-2-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier The current pending table parsing code assumes that we keep the previous read of the pending bits, but keep that variable in the current block, making sure it is discarded on each loop. We end-up using whatever is on the stack. Who knows, it might just be the right thing... Fixes: 280771252c1ba ("KVM: arm64: vgic-v3: KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES") Cc: # 4.12 Reported-by: AKASHI Takahiro Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.2 diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 2f05f732d3fd..f47e8481fa45 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c @@ -327,13 +327,13 @@ int vgic_v3_save_pending_tables(struct kvm *kvm) int last_byte_offset = -1; struct vgic_irq *irq; int ret; + u8 val; list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { int byte_offset, bit_nr; struct kvm_vcpu *vcpu; gpa_t pendbase, ptr; bool stored; - u8 val; vcpu = irq->target_vcpu; if (!vcpu)