Received: by 10.213.65.68 with SMTP id h4csp910932imn; Tue, 27 Mar 2018 11:02:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48TKFgD5w/lx3n9FeOyT70wb6+1YtmE8FI8AB153HU6PkPWAvm+WS9bVpY6IA148XVb7wUB X-Received: by 10.99.98.134 with SMTP id w128mr197662pgb.217.1522173759474; Tue, 27 Mar 2018 11:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173759; cv=none; d=google.com; s=arc-20160816; b=FXjLAyBRG56Ef3zvhwZ6nxaUEfvp8i5q+Aw/dfohg8zkNb2nmkicq4WCO4m3+SwDD1 NuE84l6zT08quRDkqTLIMvpdA52oVIQtbROWSxXb+DjjgTXWSLQAQQBlVUsuvegClfYu qByhbDry4rfsLfHU7cyp+UJpExC0juCWzwpKwdUrMruvG+0ATmcIgPBMbYI/pj6urCmM 2/zZR8lN0IMa9TQ7wdq5HAtCO+pd5rNp4PxJPdHlTd3/hqSZFQpqAjLOKSru0VDd1Gah gRuWHmj8I2z4dU1HAhkkpccNOjQWt6E569+MTh4QWuZrOPtNYaYBINdB9JhgQKztMkaC Uxcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Iz9O12fqpPgwA8bwKL2MjZ/fNGBq+G/paIE043/BoLY=; b=hiWZLSu6q4YM8PrF5UOYMI9fq0efas8EIDShzpj6KPVf/5rO0C4ZdxboAN53UMy92v xudprQi1fTT62ffHGUV1c1OG2uMfQ5z33Q3fh8ChO8bNA+0fUNVJT3mxOFo7X7VXk0TJ qJh5FghLvmRJpZZGXvF5K61LoWwmGC4oqH5SfkHd4WMvEXGKjU7QsTwK8T6FaCS1NVzk cCes3CoPw8nZA26BPL44uec+LtpcPFNWtBCLlyLMa9NBakLMiSPTzjqIMI8Bh+/wkNpq mHHPpdTAzrzYPSnXSdVYahHMkk/SwuzbLbllHpyFqTO3guAUcUJMo3wt+TPpCl/WwvI8 tjdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e2si1118565pgs.22.2018.03.27.11.02.24; Tue, 27 Mar 2018 11:02:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbeC0SAJ (ORCPT + 99 others); Tue, 27 Mar 2018 14:00:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41788 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752230AbeC0QaT (ORCPT ); Tue, 27 Mar 2018 12:30:19 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A04D8117C; Tue, 27 Mar 2018 16:30:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H.J. Lu" , Andy Shevchenko , Eric Biederman , "H. Peter Anvin" , Juergen Gross , Kees Cook , "Kirill A. Shutemov" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.4 37/43] x86/boot/64: Verify alignment of the LOAD segment Date: Tue, 27 Mar 2018 18:27:41 +0200 Message-Id: <20180327162718.493958167@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: H.J. Lu commit c55b8550fa57ba4f5e507be406ff9fc2845713e8 upstream. Since the x86-64 kernel must be aligned to 2MB, refuse to boot the kernel if the alignment of the LOAD segment isn't a multiple of 2MB. Signed-off-by: H.J. Lu Cc: Andy Shevchenko Cc: Eric Biederman Cc: H. Peter Anvin Cc: Juergen Gross Cc: Kees Cook Cc: Kirill A. Shutemov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/CAMe9rOrR7xSJgUfiCoZLuqWUwymRxXPoGBW38%2BpN%3D9g%2ByKNhZw@mail.gmail.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/compressed/misc.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -366,6 +366,10 @@ static void parse_elf(void *output) switch (phdr->p_type) { case PT_LOAD: +#ifdef CONFIG_X86_64 + if ((phdr->p_align % 0x200000) != 0) + error("Alignment of LOAD segment isn't multiple of 2MB"); +#endif #ifdef CONFIG_RELOCATABLE dest = output; dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);