Skip to content

kexec_file: Clean up purgatory load

Philipp Rudo kexec linux-s390 lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 4 repliesIn review
  2. v111 patches 19 repliesSuperseded

Changes in v2 from the cover letter

* Fix missing memcpy and memset definition in x86 purgatory introduced by moving the sha256 implementation to common code.
* Update subject of patches #7-9 to be more precise.
* Add missing semicolon in patch #7 found by kbuild bot.
* Fix compile warnings found by kbuild bot by moving all kexec_file specific function declarations into a 'ifdef CONFIG_KEXEC_FILE' block (patch #5 and #10).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11kexec_file: Silence compile warningsinclude/linux/kexec.h+2 -00 replies
2/11kexec_file: Remove checks in kexec_purgatory_loadkernel/kexec_file.c+0 -140 replies
3/11kexec_file: Make purgatory_info->ehdr constinclude/linux/kexec.h kernel/kexec_file.c+13 -80 replies
4/11kexec_file: Search symbols in read-only kexec_purgatorykernel/kexec_file.c+22 -160 replies
5/11kexec_file: Use read-only sections in arch_kexec_apply_relocations*arch/x86/kernel/machine_kexec_64.c include/linux/kexec.h kernel/kexec_file.c+71 -610 replies
6/11kexec_file: Split up __kexec_load_puragorykernel/kexec_file.c+103 -970 replies
7/11kexec_file: Remove unneeded for-loop in kexec_purgatory_setup_sechdrskernel/kexec_file.c+30 -460 replies
8/11kexec_file: Remove unneeded variables in kexec_purgatory_setup_sechdrskernel/kexec_file.c+12 -220 replies
9/11kexec_file: Remove mis-use of sh_offset field during purgatory loadarch/x86/kernel/machine_kexec_64.c kernel/kexec_file.c+13 -340 replies
10/11kexec_file: Allow archs to set purgatory load addressarch/powerpc/kernel/kexec_elf_64.c arch/x86/kernel/kexec-bzimage64.c include/linux/kexec.h +1 more+31 -320 replies
11/11kexec_file: Move purgatories sha256 to common codearch/x86/purgatory/Makefile arch/x86/purgatory/purgatory.c arch/x86/purgatory/string.c +2 more+28 -40 replies

Reviews trailers per patch

2 of 11 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMartin SchwidefskyDave Young
SeriesA-b
1/11
2/11
3/11
4/11
5/11
6/11
7/11R-b
8/11
9/11
10/11R-b
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] kexec_file: Clean up purgatory load

Hi everybody

here is the updated patch set including Dave's comments.

Changes v1 -> v2:
* Fix missing memcpy and memset definition in x86 purgatory introduced by moving the sha256 implementation to common code.
* Update subject of patches #7-9 to be more precise.
* Add missing semicolon in patch #7 found by kbuild bot.
* Fix compile warnings found by kbuild bot by moving all kexec_file specific function declarations into a 'ifdef CONFIG_KEXEC_FILE' block (patch #5 and #10).

Thanks
Philipp

---

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: Remove unneeded for-loop in kexec_purgatory_setup_sechdrs
kexec_file: Remove unneeded variables in kexec_purgatory_setup_sechdrs
kexec_file: Remove mis-use of sh_offset field during purgatory load
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 +-
 arch/x86/purgatory/string.c                    |  12 +
 include/linux/kexec.h                          |  49 ++--
 {arch/x86/purgatory => include/linux}/sha256.h |  11 +-
 kernel/kexec_file.c                            | 379 ++++++++++++-------------
 {arch/x86/purgatory => lib}/sha256.c           |   4 +-
 10 files changed, 267 insertions(+), 276 deletions(-)
 rename {arch/x86/purgatory => include/linux}/sha256.h (62%)
 rename {arch/x86/purgatory => lib}/sha256.c (99%)
Signature · 1 line
2.13.5