Received: by 10.213.65.68 with SMTP id h4csp900235imn; Tue, 27 Mar 2018 10:50:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/28bW4A3aFrX5ADCKOnaGNTp36j9lmJzrnyEsnYaQ9Yv/1shkp9u4g+GEvBoETpaGCtNWM X-Received: by 2002:a17:902:b181:: with SMTP id s1-v6mr246539plr.263.1522173025785; Tue, 27 Mar 2018 10:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173025; cv=none; d=google.com; s=arc-20160816; b=knv1rsK1F8CPi3B/Fyy07ieT1jE5jLESPLE9hG+6GnIIxe7yrEc7x2IU3u7ee6bhsy uGZglhyNdlqwIBsbyycnFmU4TdbpDPkR2dJp94Gl40G9vJ0j7f95EdKDTJCPMm0TGzE3 DILDzlFc0Do3uBq8cmQy+d5a9sffyUagZ1fo+QEiRd/adBxcMRjqYMtKsnTwD+5TEs9d NOknis2s7metnuvAOHv8ZJ7//JGHAZY732Je4D4vCBB/G9U7CAPHYvC+LkgkZegE73fT 1Zsh0arxdM8OJlwlxz6NLgC6lH804xENHnJ9AT9qUw+l7XQB+dAbpqy0xXcHiU/gQrVR YMnw== 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=L7xsApS5OzAsDqaLx5Uz0TpbINTu3nDEXDdSZ97d68I=; b=IZtDLznmqeSN/LzTdx+O0h7GvfHjVhDD21CYtT9J5vTJ49kzYKPIZ8P9JWaR1cXjq6 eJFNmfn6b7bat4mh3EcqRstmz9DUpwk138kFOBQQIpjBI/4TuaKYxPx0dtOwL4ue+J7H Q+CVN/0qL8s6piB6d1wIITQ/q9lIfgnhoxY7VWwnMOrVU4U+J9KfKL6iEMbdXN5s4YyC KF22GqD+aN1e9ayQUhHtm8cv1pSq5izxbTRs1dpTHifTPf4wU4S8q00tuuXvMov9V6iZ j5nX9aMjxwQ0fF4Se4/Rv376XYTIXfWhDd6EupwPw43ivAZj6EwM+tkxK6XGzd2gqs4Q x+vA== 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 s78si1215025pfj.259.2018.03.27.10.50.11; Tue, 27 Mar 2018 10:50:25 -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 S1753954AbeC0Rsb (ORCPT + 99 others); Tue, 27 Mar 2018 13:48:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43452 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753720AbeC0Qck (ORCPT ); Tue, 27 Mar 2018 12:32:40 -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 B9BA3FE1; Tue, 27 Mar 2018 16:32:39 +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.9 52/67] x86/boot/64: Verify alignment of the LOAD segment Date: Tue, 27 Mar 2018 18:27:44 +0200 Message-Id: <20180327162730.311816865@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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 @@ -299,6 +299,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);