Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3794434imm; Mon, 18 Jun 2018 04:18:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLfCfBilvL5thxH2N7z5qqua1kqKTdpYvKWga5/SokBpnMcTElV5K9hX2YgveesudPrVrll X-Received: by 2002:a65:6319:: with SMTP id g25-v6mr10806221pgv.437.1529320690867; Mon, 18 Jun 2018 04:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529320690; cv=none; d=google.com; s=arc-20160816; b=dtSLqSupH4UAAgCPnoovLSCY12qcfakqb0ZRut/SzhJNsFOkgwnilpYjKJoHSrn3tF Eim8TbENQazMesck51jbi0B3Tc48V4vJqFtlgZ5dl2EVGMF9oH2lSavOSTDHrntp+f6K EviB0tCxptudSFpc9PHYoOvnkXMaupfhQr//0tV9RWZUG25skTHedg2uEUNIoUehMfR9 iBWiEzjViyrsb+TgfrTcKUKwwOCm090crYPG/blj+2s/bSj6y/76N9zQEdLB7ClRJsCA wZ09+VYRTyKlwo8f0OYMlpFQ4gydhZZC0KSirS+0Aj6wVmZgOofeCIX9/rofX54G+kbc ZAOQ== 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=6puqFTlEvpSm0PZyEYcU9ux75D4zddMhYUAXNbFPKSg=; b=NWLzgTj/AcEq2Q6wm4DuVBVJLoFbizE8G/bmEzYuN5lxN71ADbfeRjFYGrETrXgYRC boEp8+MImc0ohnLOILCvEb/46FQXhjesRMeOoCXeDJooa9cWl7NwojsaQR9lleHUv/88 gL/1HGMM9siUWNoAkx8r1JM6tNP24ZJBDunMMKSCAaCPeV4/CS2N1XLTV2FK7Qnisqhf txttnqA1ZVwqPNKT6RmSoW0W9q6JiIvfLMxliBgJQPIUBDCHa4NVScljp31mul+q2PS4 q7UzVnqVC4ufN1vzFjXR8YBo2W4IvabIRaOKW2wTfF59F4Ahu59LmdtN2RfdpCE5ABDp ShyA== 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 m63-v6si14077233pld.429.2018.06.18.04.17.56; Mon, 18 Jun 2018 04:18:10 -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 S935026AbeFRISK (ORCPT + 99 others); Mon, 18 Jun 2018 04:18:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54436 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934957AbeFRISF (ORCPT ); Mon, 18 Jun 2018 04:18:05 -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 0D098C75; Mon, 18 Jun 2018 08:18:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Young , joeyli , Randy Wright , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.16 070/279] kexec_file: do not add extra alignment to efi memmap Date: Mon, 18 Jun 2018 10:10:55 +0200 Message-Id: <20180618080611.713708796@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Young [ Upstream commit a841aa83dff0af75c88aa846ba610a8af4c5ee21 ] Chun-Yi reported a kernel warning message below: WARNING: CPU: 0 PID: 0 at ../mm/early_ioremap.c:182 early_iounmap+0x4f/0x12c() early_iounmap(ffffffffff200180, 00000118) [0] size not consistent 00000120 The problem is x86 kexec_file_load adds extra alignment to the efi memmap: in bzImage64_load(): efi_map_sz = efi_get_runtime_map_size(); efi_map_sz = ALIGN(efi_map_sz, 16); And __efi_memmap_init maps with the size including the alignment bytes but efi_memmap_unmap use nr_maps * desc_size which does not include the extra bytes. The alignment in kexec code is only needed for the kexec buffer internal use Actually kexec should pass exact size of the efi memmap to 2nd kernel. Link: http://lkml.kernel.org/r/20180417083600.GA1972@dhcp-128-65.nay.redhat.com Signed-off-by: Dave Young Reported-by: joeyli Tested-by: Randy Wright Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/kexec-bzimage64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -398,11 +398,10 @@ static void *bzImage64_load(struct kimag * little bit simple */ efi_map_sz = efi_get_runtime_map_size(); - efi_map_sz = ALIGN(efi_map_sz, 16); params_cmdline_sz = sizeof(struct boot_params) + cmdline_len + MAX_ELFCOREHDR_STR_LEN; params_cmdline_sz = ALIGN(params_cmdline_sz, 16); - kbuf.bufsz = params_cmdline_sz + efi_map_sz + + kbuf.bufsz = params_cmdline_sz + ALIGN(efi_map_sz, 16) + sizeof(struct setup_data) + sizeof(struct efi_setup_data); @@ -410,7 +409,7 @@ static void *bzImage64_load(struct kimag if (!params) return ERR_PTR(-ENOMEM); efi_map_offset = params_cmdline_sz; - efi_setup_data_offset = efi_map_offset + efi_map_sz; + efi_setup_data_offset = efi_map_offset + ALIGN(efi_map_sz, 16); /* Copy setup header onto bootparams. Documentation/x86/boot.txt */ setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset;