Received: by 10.223.185.82 with SMTP id b18csp148324wrg; Thu, 8 Mar 2018 21:35:49 -0800 (PST) X-Google-Smtp-Source: AG47ELvU8vAJdNqwPsQr7T4p+6uvTLxE7afBrPrN9Ee7CUGKJc8LIjobYp256NbvyFDD8d38TTSc X-Received: by 2002:a17:902:22f:: with SMTP id 44-v6mr26135331plc.418.1520573749368; Thu, 08 Mar 2018 21:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520573749; cv=none; d=google.com; s=arc-20160816; b=0vMI7+IznotTWV+G2pgMPtrSWefPdnAuap3owhbHqR+QQ8tgtJUxhye7ogS+3/Tcij /qDB0GFL9en0hneZrg5VbUDnviCRLlmeS4ttq+TJNUqWjDsPC0h3QjmBi6hYKfLx9FD7 fD3y2MgTEZyrnfZDZfWaO7PVUTLZ8obxZTSoT3rejDbA6K1u13hUO3M8/dhWZ7F6EWme SDxhWFUDihZGFSVxbCcqhwvLSKFOy9gDkkRQTd6lmV2qFLRFd20XuI97UvDgLDx2POg8 Wm1dIz/GH+959EeusF+f4l4/bkvm6fDRZQ6wd5iX2eYuwh5p8Uk5dBQwnn2UkCztMP02 iJ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=dl1PMHpVGZID0rn1zlqygvI2Yzk20lUArxyAjhu/yYI=; b=ONPfEl9ldhXPUj3LTq5ib0nEhnVhPPiLu2fWRJ7eUNJy5bPS+xQyP79B6kAMCT7dZC lZ8zNTlTucJnjUCY35/vgRKQGKV+ce44QnebFBkYxYpMswPThDxCxHW/JGs91qMA2+ta LYnPUfk6Pw/tempQc47/SWVEtXZqyLLSd/WmLFf4ruTZkRdRr2DjOfMLqiUwGGrepgW3 TPpxm0MoiXz0K4lHdb+RTB7zd7Xjn4dyYU11hhVn+0pk15Rn7IODh1mwCzzPukQRAvh4 fdTxcVzYMxDwffNIZjQZN/MtnzdWNfeBhsZVkFyLULEB9A185m6X4vihH0PwnV2T5UJV Zrsw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12-v6si267657plk.295.2018.03.08.21.35.23; Thu, 08 Mar 2018 21:35:49 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750948AbeCIFeA (ORCPT + 99 others); Fri, 9 Mar 2018 00:34:00 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46670 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750742AbeCIFd7 (ORCPT ); Fri, 9 Mar 2018 00:33:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98745D142C; Fri, 9 Mar 2018 05:33:58 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-192.pek2.redhat.com [10.72.12.192]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B717202322B; Fri, 9 Mar 2018 05:33:52 +0000 (UTC) Date: Fri, 9 Mar 2018 13:33:48 +0800 From: Dave Young To: Philipp Rudo Cc: kexec@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biederman , Vivek Goyal , Michael Ellerman , Thiago Jung Bauermann , Martin Schwidefsky , Heiko Carstens , Andrew Morton , x86@kernel.org, AKASHI Takahiro Subject: Re: [PATCH 00/11] kexec_file: Clean up purgatory load Message-ID: <20180309053348.GA2042@dhcp-128-65.nay.redhat.com> References: <20180226151620.20970-1-prudo@linux.vnet.ibm.com> <20180309051913.GA9358@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180309051913.GA9358@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 05:33:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 05:33:58 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/09/18 at 01:19pm, Dave Young wrote: > Hi Philipp, > On 02/26/18 at 04:16pm, Philipp Rudo wrote: > > > > Hi everybody > > > > following the discussion with Dave and AKASHI, here are the common code > > patches extracted from my recent patch set (Add kexec_file_load support to > > s390) [1]. The patches were extracted to allow upstream integration together > > with AKASHI's common code patches before the arch code gets adjusted to the > > new base. > > > > The reason for this series is to prepare common code for adding > > kexec_file_load to s390 as well as cleaning up the mis-use of the sh_offset > > field during purgatory load. In detail this series contains: > > > > Patch #1&2: Minor cleanups/fixes. > > > > Patch #3-9: Clean up the purgatory load/relocation code. Especially remove > > the mis-use of the purgatory_info->sechdrs->sh_offset field, currently > > holding a pointer into either kexec_purgatory (ro) or purgatory_buf (rw) > > depending on the section. With these patches the section address will be > > calculated verbosely and sh_offset will contain the offset of the section > > in the stripped purgatory binary (purgatory_buf). > > > > Patch #10: Allows architectures to set the purgatory load address. This > > patch is important for s390 as the kernel and purgatory have to be loaded > > to fixed addresses. In current code this is impossible as the purgatory > > load is opaque to the architecture. > > > > Patch #11: Moves x86 purgatories sha implementation to common lib/ > > directory to allow reuse in other architectures. > > > > The patches apply to v4.16-rc3. There are no changes compared to [1] (all > > requested changes only affected s390 code). Please note that I had to touch > > arch code for x86 and power a little. In theory this should not change the > > behavior but I don't have a way to test it. Cross-compiling with > > defconfig [2] works fine for both. > > > > Thanks > > Philipp > > > > [1] http://lists.infradead.org/pipermail/kexec/2018-February/019926.html > > [2] On x86 with the orc unwinder and stack validation turned off. objtool > > SEGFAULTs on s390... > > > > Philipp Rudo (11): > > kexec_file: Silence compile warnings > > kexec_file: Remove checks in kexec_purgatory_load > > kexec_file: Make purgatory_info->ehdr const > > kexec_file: Search symbols in read-only kexec_purgatory > > kexec_file: Use read-only sections in arch_kexec_apply_relocations* > > kexec_file: Split up __kexec_load_puragory > > kexec_file: Simplify kexec_purgatory_setup_sechdrs 1 > > kexec_file: Simplify kexec_purgatory_setup_sechdrs 2 > > kexec_file: Remove mis-use of sh_offset field > > kexec_file: Allow archs to set purgatory load address > > kexec_file: Move purgatories sha256 to common code > > > > arch/powerpc/kernel/kexec_elf_64.c | 9 +- > > arch/x86/kernel/kexec-bzimage64.c | 8 +- > > arch/x86/kernel/machine_kexec_64.c | 66 ++--- > > arch/x86/purgatory/Makefile | 3 + > > arch/x86/purgatory/purgatory.c | 2 +- > > include/linux/kexec.h | 38 +-- > > {arch/x86/purgatory => include/linux}/sha256.h | 10 +- > > kernel/kexec_file.c | 375 ++++++++++++------------- > > {arch/x86/purgatory => lib}/sha256.c | 4 +- > > 9 files changed, 244 insertions(+), 271 deletions(-) > > rename {arch/x86/purgatory => include/linux}/sha256.h (63%) > > rename {arch/x86/purgatory => lib}/sha256.c (99%) > > > > -- > > 2.13.5 > > > > I did a test on x86, but it failed: > [ 15.636489] kexec: Undefined symbol: memcpy > [ 15.636496] kexec-bzImage64: Loading purgatory failed > [ 33.603356] kexec: Undefined symbol: memcpy > [ 33.603362] kexec-bzImage64: Loading purgatory failed > > I think this relates to the sha256 splitting patch. > > After reverting the sha256 patch (the last one), rebuilt a kernel but it still > failed to load: > > # kexec -d -s -l /home/dyoung/git/linux-x86/sign/bzImage.signed > Try gzip decompression. > Try LZMA decompression. > lzma_decompress_file: read on /home/dyoung/git/linux-x86/sign/bzImage.signed of 65536 bytes failed Oops, this lzma error message should be not harmful, actually kernel should have been loaded, I will do more tests anyway. > > Thanks > Dave