Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Philipp, On 03/20/18 at 10:39am, Philipp Rudo wrote: > Hi Dave, > > sorry for the late answer. > > > On Fri, 16 Mar 2018 14:41:02 +0800 > Dave Youngwrote: > > > On 03/15/18 at 11:13am, Philipp Rudo wrote: > > > Hi Dave, > > > > > > On Thu, 15 Mar 2018 15:34:22 +0800 > > > Dave Young wrote: > > > > > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > > > Hi Philipp, > > > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > > > Hi Dave, > > > > > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > > > 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|
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Philipp, On 03/20/18 at 10:39am, Philipp Rudo wrote: > Hi Dave, > > sorry for the late answer. > > > On Fri, 16 Mar 2018 14:41:02 +0800 > Dave Young wrote: > > > On 03/15/18 at 11:13am, Philipp Rudo wrote: > > > Hi Dave, > > > > > > On Thu, 15 Mar 2018 15:34:22 +0800 > > > Dave Young wrote: > > > > > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > > > Hi Philipp, > > > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > > > Hi Dave, > > > > > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > > > 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 > > > > > > > > - > > > > > >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, sorry for the late answer. On Fri, 16 Mar 2018 14:41:02 +0800 Dave Youngwrote: > On 03/15/18 at 11:13am, Philipp Rudo wrote: > > Hi Dave, > > > > On Thu, 15 Mar 2018 15:34:22 +0800 > > Dave Young wrote: > > > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > > Hi Philipp, > > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > > Hi Dave, > > > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > > 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
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, sorry for the late answer. On Fri, 16 Mar 2018 14:41:02 +0800 Dave Young wrote: > On 03/15/18 at 11:13am, Philipp Rudo wrote: > > Hi Dave, > > > > On Thu, 15 Mar 2018 15:34:22 +0800 > > Dave Young wrote: > > > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > > Hi Philipp, > > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > > Hi Dave, > > > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > > 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%) > > > > > > > > > > >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
On 03/15/18 at 11:13am, Philipp Rudo wrote: > Hi Dave, > > On Thu, 15 Mar 2018 15:34:22 +0800 > Dave Youngwrote: > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > Hi Philipp, > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > Hi Dave, > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > 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:
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
On 03/15/18 at 11:13am, Philipp Rudo wrote: > Hi Dave, > > On Thu, 15 Mar 2018 15:34:22 +0800 > Dave Young wrote: > > > On 03/12/18 at 03:40pm, Dave Young wrote: > > > Hi Philipp, > > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > > Hi Dave, > > > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > > 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]
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Thu, 15 Mar 2018 15:34:22 +0800 Dave Youngwrote: > On 03/12/18 at 03:40pm, Dave Young wrote: > > Hi Philipp, > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > Hi Dave, > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > 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. > > > > > > I looked into this a little closer and i think i understood what happens. > > > > > > There is no definition of memcpy in
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Thu, 15 Mar 2018 15:34:22 +0800 Dave Young wrote: > On 03/12/18 at 03:40pm, Dave Young wrote: > > Hi Philipp, > > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > > Hi Dave, > > > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > > 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. > > > > > > I looked into this a little closer and i think i understood what happens. > > > > > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > > >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
On 03/12/18 at 03:40pm, Dave Young wrote: > Hi Philipp, > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > Hi Dave, > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > Dave Youngwrote: > > > > > 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. > > > > I looked into this a little closer and i think i understood what happens. > > > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > > defined > > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > > switching to linux/string.h there is no more definition for it. Leaving us > > with > > > > $ readelf -s purgatory.ro > > [...] > > 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy > > [...] > > > > To solve this problem I see two
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
On 03/12/18 at 03:40pm, Dave Young wrote: > Hi Philipp, > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > Hi Dave, > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > 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. > > > > I looked into this a little closer and i think i understood what happens. > > > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > > defined > > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > > switching to linux/string.h there is no more definition for it. Leaving us > > with > > > > $ readelf -s purgatory.ro > > [...] > > 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy > > [...] > > > > To solve this problem I see two possibilities (example
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Ingo, do you have an idea about this? This problem is currently holding me back to send a v2 of the patch set. Thanks Philipp On Mon, 12 Mar 2018 15:40:16 +0800 Dave Youngwrote: > Hi Philipp, > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > Hi Dave, > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > 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. > > > > I looked into this a little closer and i think i understood what happens. > > > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > > defined > > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > > switching to linux/string.h there is no more definition for it. Leaving us > >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Ingo, do you have an idea about this? This problem is currently holding me back to send a v2 of the patch set. Thanks Philipp On Mon, 12 Mar 2018 15:40:16 +0800 Dave Young wrote: > Hi Philipp, > On 03/09/18 at 03:25pm, Philipp Rudo wrote: > > Hi Dave, > > > > On Fri, 9 Mar 2018 13:19:40 +0800 > > 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. > > > > I looked into this a little closer and i think i understood what happens. > > > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > > defined > > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > > switching to linux/string.h there is no more definition for it. Leaving us > > with > > > > $ readelf -s
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Philipp, On 03/09/18 at 03:25pm, Philipp Rudo wrote: > Hi Dave, > > On Fri, 9 Mar 2018 13:19:40 +0800 > Dave Youngwrote: > > > 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. > > I looked into this a little closer and i think i understood what happens. > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > defined > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > switching to linux/string.h there is no more definition for it. Leaving us > with > > $ readelf -s purgatory.ro > [...] > 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy > [...] > > To solve this problem I see two possibilities (example patches are at the end > of > the mail): > > 1) Have arch dependent includes in lib/sha256.c > 2) Add makefile magic so memcpy is defined > > With both solutions the resulting purgatory.ro looks good. However both > solutions aren't perfect. For example in 2) i had too mix the linux/string.h >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Philipp, On 03/09/18 at 03:25pm, Philipp Rudo wrote: > Hi Dave, > > On Fri, 9 Mar 2018 13:19:40 +0800 > 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. > > I looked into this a little closer and i think i understood what happens. > > There is no definition of memcpy in arch/x86/boot/string.c, instead it's > defined > in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by > switching to linux/string.h there is no more definition for it. Leaving us > with > > $ readelf -s purgatory.ro > [...] > 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy > [...] > > To solve this problem I see two possibilities (example patches are at the end > of > the mail): > > 1) Have arch dependent includes in lib/sha256.c > 2) Add makefile magic so memcpy is defined > > With both solutions the resulting purgatory.ro looks good. However both > solutions aren't perfect. For example in 2) i had too mix the linux/string.h > header with
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Fri, 9 Mar 2018 13:19:40 +0800 Dave Youngwrote: > 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. I looked into this a little closer and i think i understood what happens. There is no definition of memcpy in arch/x86/boot/string.c, instead it's defined in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by switching to linux/string.h there is no more definition for it. Leaving us with $ readelf -s purgatory.ro [...] 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy [...] To solve this problem I see two possibilities (example patches are at the end of the mail): 1) Have arch dependent includes in lib/sha256.c 2) Add makefile magic so memcpy is defined With both solutions the resulting purgatory.ro looks good. However both solutions aren't perfect. For example in 2) i had too mix the linux/string.h header with arch/x86/boot/string.c, because lib/string.c has too many dependencies and does not compile in the purgatory. On the other hand having arch dependent includes isn't that nice either ... What's your opinion on this? Thanks Philipp - Example solution 1 --- a/lib/sha256.c +++ b/lib/sha256.c @@
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Fri, 9 Mar 2018 13:19:40 +0800 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. I looked into this a little closer and i think i understood what happens. There is no definition of memcpy in arch/x86/boot/string.c, instead it's defined in arch/x86/boot/string.h as __buildin_memcpy (same for memset). Thus by switching to linux/string.h there is no more definition for it. Leaving us with $ readelf -s purgatory.ro [...] 45: 0 NOTYPE GLOBAL DEFAULT UND memcpy [...] To solve this problem I see two possibilities (example patches are at the end of the mail): 1) Have arch dependent includes in lib/sha256.c 2) Add makefile magic so memcpy is defined With both solutions the resulting purgatory.ro looks good. However both solutions aren't perfect. For example in 2) i had too mix the linux/string.h header with arch/x86/boot/string.c, because lib/string.c has too many dependencies and does not compile in the purgatory. On the other hand having arch dependent includes isn't that nice either ... What's your opinion on this? Thanks Philipp - Example solution 1 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -17,9 +17,14 @@
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Fri, 9 Mar 2018 13:33:48 +0800 Dave Youngwrote: > 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 for having a look. Please let me know when you find more problems. Philipp > > > > Thanks > > Dave >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
Hi Dave, On Fri, 9 Mar 2018 13:33:48 +0800 Dave Young wrote: > 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 for having a look. Please let me know when you find more problems. Philipp > > > > Thanks > > Dave >
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
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
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
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
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
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 Thanks Dave
Re: [PATCH 00/11] kexec_file: Clean up purgatory load
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 Thanks Dave
[PATCH 00/11] kexec_file: Clean up purgatory load
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
[PATCH 00/11] kexec_file: Clean up purgatory load
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