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: 2505261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 017B8DF2F2 for ; Tue, 30 Apr 2013 14:53:34 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBuM-00023s-An; Tue, 30 Apr 2013 14:51:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBtr-0003AJ-UI; Tue, 30 Apr 2013 14:51:23 +0000 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBsw-0002z9-6N for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2013 14:50:27 +0000 Received: by mail-pb0-f41.google.com with SMTP id md4so298750pbc.28 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=ao9tUeHwrzAZH785ZowBHTeE8D7/aDCgwMymt3VEnMpKg0QgvmjByuBfLBZWi35eYW pwenx6j2KZ489es06ui7iTQ+cLOmmYVLNT41ZKZhxpg81wCr7fdZfy6zBhsm5u7t8gd4 qajVaHai0CKfZhmYCKp8nsU8bBXoO55W2Skox6l99ASaP2c5Rz1SxU516jagaiPzxDlx 5tcRvj4zRTVxG45+X+wmcPhNmfy78mUYvsgrfNfRCQ8JkAk7o6pruXxmtQksk25VT3XH eSr+57MvSR0fae9+SuvvIhJlffQkHUb+WLRRwOvsqq42CmH6AUi8ULEWflgXJyzt2Hw7 ZToQ== 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 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: ALoCoQlg5ll2k6jFyLwd/n5/8nYB9SshTXwt2B2P5iRDckkUFun5Cpc5FTNLW4/mWvBz2xo6GoHg X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130430_105026_363174_932E9299 X-CRM114-Status: GOOD ( 11.43 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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")