From patchwork Tue Apr 30 14:49:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2505091 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EF821DF5B1 for ; Tue, 30 Apr 2013 14:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932439Ab3D3OuK (ORCPT ); Tue, 30 Apr 2013 10:50:10 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:37741 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932419Ab3D3OuE (ORCPT ); Tue, 30 Apr 2013 10:50:04 -0400 Received: by mail-pa0-f44.google.com with SMTP id rl6so394321pac.3 for ; Tue, 30 Apr 2013 07:50:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=XR1P2R4gOY6iKBkpdvrbn3AN7LMfL7cStyQD8IrGBF0=; b=kCoVyADIGGHYUAyiY0u6DGq85DH9Al06LXIn5+l+baFjUcNrgmPHRo40yo4lVMpnQo C74tNHyen7M8A2a+ChyDUR3+5L/VVckRZOZzoUJlX61w5SP/cBEVJXd70yg1W9W1LZ5Z utNtaT7tRAOY7C0QUx/K2ZWZFzxOjh57uYXlu9Vd/uu3KhzeKkytWQrMEZqaCMxTlCsY pK5+jofSXdykI8UkDeZFTLPwDTTzxbR/VM80L5DBEGMsvG5rG1oiDlHTGHVcTJVkjF3s CvXuABsD7xeiZ9KIGkxJAqtMWpJG7VzRy1A7B+WouvFs6bClUxwVHj5Pv7qS3TPDlh5V WcRA== X-Received: by 10.68.226.230 with SMTP id rv6mr38850999pbc.55.1367333404056; Tue, 30 Apr 2013 07:50:04 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id cq1sm28799244pbc.13.2013.04.30.07.50.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Apr 2013 07:50:03 -0700 (PDT) From: Christoffer Dall To: kvm@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Marc Zyngier , Christoffer Dall Subject: [PATCH 06/15] ARM: KVM: enforce maximum size for identity mapped code Date: Tue, 30 Apr 2013 07:49:27 -0700 Message-Id: <1367333376-30983-7-git-send-email-cdall@cs.columbia.edu> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> References: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> X-Gm-Message-State: ALoCoQkILEvxYDBbPRigSTklaUcdeUPAn9Kve5KTfWxNhoO7qTnjFeZnsXk02OMHZnbN3zmTshnx Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Zyngier We're about to move to an init procedure where we rely on the fact that the init code fits in a single page. Make sure we align the idmap text on a vector alignment, and that the code is not bigger than a single page. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kernel/vmlinux.lds.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index b571484..a871b8e 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -20,7 +20,7 @@ VMLINUX_SYMBOL(__idmap_text_start) = .; \ *(.idmap.text) \ VMLINUX_SYMBOL(__idmap_text_end) = .; \ - ALIGN_FUNCTION(); \ + . = ALIGN(32); \ VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ *(.hyp.idmap.text) \ VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; @@ -315,3 +315,8 @@ SECTIONS */ ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") +/* + * The HYP init code can't be more than a page long. + * The above comment applies as well. + */ +ASSERT(((__hyp_idmap_text_end - __hyp_idmap_text_start) <= PAGE_SIZE), "HYP init code too big")