From patchwork Mon Aug 4 08:47:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 34818 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BBED521F5F for ; Mon, 4 Aug 2014 09:02:29 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf36278474obc.4 for ; Mon, 04 Aug 2014 02:02:29 -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=14ZDF1HzUAfiL592Op1vXpG0K2yhyV8dJMdrF8pahRU=; b=cLuoDmZ6CsyvgewgYQnEmCqwPZFM4Xkg+XtRLg2IgoB3nFYUMw+LeWCGdOVQpuaEiT vABgHvocYDpn7Z3PFlse3rCU2Xk5kB14XsPE11DmfzCEGQpy3ufq4fexH5/eg+6EgvBC uT9U/r4oU/X58wTIBF02lwW6eHR6D6JdPgrAxO6uMLuhcEgLMJipwmwwM+RoSe4mHp1P Z0h6WQNzXDlpyNtydFvGlUnBqpp087an2tA8y/WGMozQO7YyGvlVjaadVOndZ77WKeJ5 a4FpQwPqxX6jpQFeje1NNRyt43QX3zkOMIfzkQZMAjD0tk/yTPaXImV932nzjPJFWogT hnMQ== X-Gm-Message-State: ALoCoQn5Ti32yVrzcVFCbTsJjuHqARs5wu+X5v6vXGJnWOm5t9TzYed1oFemqxCZwRks1qebonek X-Received: by 10.50.118.100 with SMTP id kl4mr5624532igb.8.1407142949210; Mon, 04 Aug 2014 02:02:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.116 with SMTP id u107ls2048714qgd.46.gmail; Mon, 04 Aug 2014 02:02:29 -0700 (PDT) X-Received: by 10.52.99.106 with SMTP id ep10mr540922vdb.73.1407142949098; Mon, 04 Aug 2014 02:02:29 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id v2si455261vck.65.2014.08.04.02.02.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 02:02:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so10559387vcb.28 for ; Mon, 04 Aug 2014 02:02:29 -0700 (PDT) X-Received: by 10.52.164.80 with SMTP id yo16mr18672554vdb.44.1407142948991; Mon, 04 Aug 2014 02:02:28 -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.221.37.5 with SMTP id tc5csp288907vcb; Mon, 4 Aug 2014 02:02:28 -0700 (PDT) X-Received: by 10.68.102.34 with SMTP id fl2mr22328038pbb.2.1407142948122; Mon, 04 Aug 2014 02:02:28 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id gv4si4352653pac.237.2014.08.04.02.02.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Aug 2014 02:02:28 -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 1XEE8q-0002ap-UT; Mon, 04 Aug 2014 09:01:16 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEDxE-0002sa-54 for linux-arm-kernel@lists.infradead.org; Mon, 04 Aug 2014 08:49:16 +0000 Received: by mail-lb0-f173.google.com with SMTP id p9so5079004lbv.18 for ; Mon, 04 Aug 2014 01:48:54 -0700 (PDT) X-Received: by 10.152.234.71 with SMTP id uc7mr22104612lac.22.1407142134175; Mon, 04 Aug 2014 01:48:54 -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 px1sm26731207lbb.46.2014.08.04.01.48.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Aug 2014 01:48:53 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [GIT PULL 50/51] KVM: arm64: GICv3: mandate page-aligned GICV region Date: Mon, 4 Aug 2014 10:47:07 +0200 Message-Id: <1407142028-31105-51-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> References: <1407142028-31105-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140804_014916_411619_E6673DDD X-CRM114-Status: GOOD ( 11.05 ) 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.217.173 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.217.173 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, 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.220.169 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 From: Marc Zyngier Just like GICv2 was fixed in 63afbe7a0ac1 (kvm: arm64: vgic: fix hyp panic with 64k pages on juno platform), mandate the GICV region to be both aligned on a page boundary and its size to be a multiple of page size. This prevents a guest from being able to poke at regions where we have no idea what is sitting there. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic-v3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c index f01d446..1c2c8ee 100644 --- a/virt/kvm/arm/vgic-v3.c +++ b/virt/kvm/arm/vgic-v3.c @@ -215,6 +215,22 @@ int vgic_v3_probe(struct device_node *vgic_node, ret = -ENXIO; goto out; } + + if (!PAGE_ALIGNED(vcpu_res.start)) { + kvm_err("GICV physical address 0x%llx not page aligned\n", + (unsigned long long)vcpu_res.start); + ret = -ENXIO; + goto out; + } + + if (!PAGE_ALIGNED(resource_size(&vcpu_res))) { + kvm_err("GICV size 0x%llx not a multiple of page size 0x%lx\n", + (unsigned long long)resource_size(&vcpu_res), + PAGE_SIZE); + ret = -ENXIO; + goto out; + } + vgic->vcpu_base = vcpu_res.start; vgic->vctrl_base = NULL; vgic->type = VGIC_V3;