From patchwork Fri Sep 26 13:16:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 37990 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97253202DB for ; Fri, 26 Sep 2014 13:26:21 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id n3sf5684061wiv.5 for ; Fri, 26 Sep 2014 06:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=BKSf0fiSQhqe+RPsvvIFPVN/f7hEKwi3CBppgRpuzd8=; b=T+OM/l6zJUJDQoYVGaXLguxvP/yuEUKfehBb2PlSRgn1TAKhxY/QUQvVkzaIi0wMvO dZvgOVDCCrZ5SWgVO7oTjf3+nyfd6oS+tv2N7/2S+Mo9HG9jL+MYzH0Zkz6sMTSoJjdl JICPosP9ieQwyRuiXeQvKlnptoQkSrksdcJ2fGz3I99m9+zsMRnR0i4HvpyYWv6aGawh YAb3EW1Fj/mmXK3XTHdnw1TzjV9vDJv3izTno0R0FMDttnN3ZlZVrKCxlfOCF/jrY/DH Qfh5L9qgumOiAtbhBUPiCfJaKLbE0k+Hb92Vv/3Umif25SOXNo4zrdt+oijOfIHN4fIx N8jA== X-Gm-Message-State: ALoCoQkv1o4l5jzIK+o9W31Bx8cVPItrDgQaZTCG1R5L1QH6fDXs1ePQLDZqbSsAg+aauP5xGYZI X-Received: by 10.152.29.130 with SMTP id k2mr2305981lah.3.1411737980737; Fri, 26 Sep 2014 06:26:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.72 with SMTP id lm8ls389096lac.9.gmail; Fri, 26 Sep 2014 06:26:20 -0700 (PDT) X-Received: by 10.112.164.203 with SMTP id ys11mr19312827lbb.83.1411737980599; Fri, 26 Sep 2014 06:26:20 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id m8si7146329lah.97.2014.09.26.06.26.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Sep 2014 06:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id l4so14548556lbv.30 for ; Fri, 26 Sep 2014 06:26:20 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr20086898laa.27.1411737979913; Fri, 26 Sep 2014 06:26:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp60159lbb; Fri, 26 Sep 2014 06:26:19 -0700 (PDT) X-Received: by 10.68.125.227 with SMTP id mt3mr31562323pbb.97.1411737978367; Fri, 26 Sep 2014 06:26:18 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c8si144241pat.196.2014.09.26.06.26.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 06:26:18 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XXVVj-0003Zo-F3; Fri, 26 Sep 2014 13:24:35 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XXVQ1-00032f-Ot for linux-arm-kernel@lists.infradead.org; Fri, 26 Sep 2014 13:18:42 +0000 Received: by mail-la0-f51.google.com with SMTP id pv20so4856307lab.38 for ; Fri, 26 Sep 2014 06:18:19 -0700 (PDT) X-Received: by 10.112.202.1 with SMTP id ke1mr19397858lbc.33.1411737499606; Fri, 26 Sep 2014 06:18:19 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id z4sm1876657laz.39.2014.09.26.06.18.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Sep 2014 06:18:18 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [PATCH 25/27] arm/arm64: KVM: Fix set_clear_sgi_pend_reg offset Date: Fri, 26 Sep 2014 15:16:58 +0200 Message-Id: <1411737420-9063-26-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1411737420-9063-1-git-send-email-christoffer.dall@linaro.org> References: <1411737420-9063-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140926_061842_010115_405A8E40 X-CRM114-Status: GOOD ( 10.65 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.51 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.51 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: linux-arm-kernel@lists.infradead.org, Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The sgi values calculated in read_set_clear_sgi_pend_reg() and write_set_clear_sgi_pend_reg() were horribly incorrectly multiplied by 4 with catastrophic results in that subfunctions ended up overwriting memory not allocated for the expected purpose. This showed up as bugs in kfree() and the kernel complaining a lot of you turn on memory debugging. This addresses: http://marc.info/?l=kvm&m=141164910007868&w=2 Reported-by: Shannon Zhao Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index b6fab0f..8629678 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -816,7 +816,7 @@ static bool read_set_clear_sgi_pend_reg(struct kvm_vcpu *vcpu, { struct vgic_dist *dist = &vcpu->kvm->arch.vgic; int sgi; - int min_sgi = (offset & ~0x3) * 4; + int min_sgi = (offset & ~0x3); int max_sgi = min_sgi + 3; int vcpu_id = vcpu->vcpu_id; u32 reg = 0; @@ -837,7 +837,7 @@ static bool write_set_clear_sgi_pend_reg(struct kvm_vcpu *vcpu, { struct vgic_dist *dist = &vcpu->kvm->arch.vgic; int sgi; - int min_sgi = (offset & ~0x3) * 4; + int min_sgi = (offset & ~0x3); int max_sgi = min_sgi + 3; int vcpu_id = vcpu->vcpu_id; u32 reg;