Received: by 10.213.65.68 with SMTP id h4csp876848imn; Tue, 27 Mar 2018 10:24:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+z5pz36RfIv/IEPYmkSytGOuu2Xwbz/7tceYGl+IKc+D7jplxipEjtxbiv9GA5+mPTa9K5 X-Received: by 10.99.97.138 with SMTP id v132mr146034pgb.138.1522171476664; Tue, 27 Mar 2018 10:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171476; cv=none; d=google.com; s=arc-20160816; b=LQiUTaS+aHg4XAHuVAujYK/I7DnieILR9lD6E9vJ0EtbFGU+rNfqVSmITgko9ej49A gi2HhHdrfhiksodGp0eTz+7mDBLBkX3d5gK7L6CHqc5iJHsN6eUPURn7RDvauQzvPIRT Rhgwn5vlbBJETNaaj08rRVG4zXx+eItWH5tCOY1N7o0XfN3SyoT6jR6S8XB9vgq2ephQ 4dFcMuCvTi6q3JZelx4DJESSzamtdpVrmCzgvx4CO7qX8bdwIJNKMnpT4uO2qHF08KcA DBosU2WIEAwMmsL5uGql4p70+scBiEx8n/Z9cH0839k4s1+3b9xZ13uEKyF4U+dwnIfu v2TQ== 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=igtS5FKFpv/ezGx3U2+RDgCBr2uRMnP7PCygsld1vHk=; b=0p0VI8HHjAWK24tG+rpE9OemRwzb2T/M1469tZ+f8GLTf1KFlkF6MmEgCq30VeHLOx /QLikiew3eZuKX2odtfgNBBGF1ieEOIdspzBAYq/fYt2WnuvBbby2UmkDQdglJOQkDV5 5eXrvbKE2Sz+9+Rq/eO6nR8hBO37hRcS2tCeswyftWq79onDfYdr8wWkQB1TZQ+2eBFr P6bHIBkR6WMqLc19KWoleRBmin6mtBYT0ACjqoOEK5Uj38aGQrBoJNl1VPXfA/fV8Xro +gh7fs2iNyjmAthRbBuvlGBRY1i3P1LPmTR+hzr5GQuahKfvdBxkStnR9Y8j9QhNfSX2 +Xcg== 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 y1-v6si1780855pli.586.2018.03.27.10.24.22; Tue, 27 Mar 2018 10:24:36 -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 S1754987AbeC0Qhh (ORCPT + 99 others); Tue, 27 Mar 2018 12:37:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46346 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754972AbeC0Qhf (ORCPT ); Tue, 27 Mar 2018 12:37:35 -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 28AA8FCA; Tue, 27 Mar 2018 16:37:34 +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.14 085/101] x86/boot/64: Verify alignment of the LOAD segment Date: Tue, 27 Mar 2018 18:27:57 +0200 Message-Id: <20180327162755.284286444@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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 @@ -309,6 +309,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);