30 Dec, 2020

1 commit

  • commit 613775d62ec60202f98d2c5f520e6e9ba6dd4ac4 upstream.

    diag308 subcode 0 performes a clear reset which inlcudes the reset of
    all registers in the system. While this is the preferred behavior when
    loading a normal kernel via kexec it prevents the crash kernel to store
    the register values in the dump. To prevent this use subcode 1 when
    loading a crash kernel instead.

    Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
    Cc: # 4.17
    Signed-off-by: Philipp Rudo
    Reported-by: Xiaoying Yan
    Tested-by: Lianbo Jiang
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Philipp Rudo
     

25 Mar, 2020

1 commit


19 Dec, 2019

2 commits

  • the purgatory must not rely on functions from the "old" kernel,
    so we must disable kasan and friends. We also need to have a
    separate copy of string.c as the default does not build memcmp
    with KASAN.

    Reported-by: kbuild test robot
    Signed-off-by: Christian Borntraeger
    Reviewed-by: Vasily Gorbik
    Signed-off-by: Vasily Gorbik

    Christian Borntraeger
     
  • Since we link purgatory with -r aka we enable "incremental linking"
    no checks for unresolved symbols are done while linking the purgatory.

    This commit adds an extra check for unresolved symbols by calling ld
    without -r before running objcopy to generate purgatory.ro.

    This will help us catch missing symbols in the purgatory sooner.

    Note this commit also removes --no-undefined from LDFLAGS_purgatory
    as that has no effect.

    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/lkml/20191212205304.191610-1-hdegoede@redhat.com
    Tested-by: Philipp Rudo
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Vasily Gorbik

    Hans de Goede
     

05 Sep, 2019

1 commit


22 Aug, 2019

2 commits

  • Before this commit lib/crypto/sha256.c has only been used in the s390 and
    x86 purgatory code, make it suitable for generic use:

    * Export interesting symbols
    * Add -D__DISABLE_EXPORTS to CFLAGS_sha256.o for purgatory builds to
    avoid the exports for the purgatory builds
    * Add to lib/crypto/Makefile and crypto/Kconfig

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Generic crypto implementations belong under lib/crypto not directly in
    lib, likewise the header should be in include/crypto, not include/linux.

    Note that the code in lib/crypto/sha256.c is not yet available for
    generic use after this commit, it is still only used by the s390 and x86
    purgatory code. Making it suitable for generic use is done in further
    patches in this series.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     

04 Jun, 2019

1 commit

  • Since commit 4c0f032d4963 ("s390/purgatory: Omit use of bin2c"),
    kexec-purgatory.c is not generated.

    purgatory and purgatory.lds are generated files, so should be ignored
    by git.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Heiko Carstens

    Masahiro Yamada
     

03 May, 2019

1 commit

  • The purgatory and boot Makefiles do not inherit the original cflags,
    so clang falls back to the default target architecture when building it,
    typically this would be x86 when cross-compiling.

    Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux
    option when cross-compiling.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Nathan Chancellor
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Arnd Bergmann
     

29 Apr, 2019

2 commits

  • Omit use of script/bin2c hack. Directly include into assembler file instead.

    Signed-off-by: Philipp Rudo
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     
  • The purgatory is compiled into the vmlinux and keept in memory all the time
    during runtime. Thus any section not needed to load the purgatory
    unnecessarily bloats up its foot print in file- and memorysize. Reduce the
    purgatory size by stripping the unneeded sections from the purgatory.

    This reduces the purgatories size by ~33%.

    Signed-off-by: Philipp Rudo
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     

20 Sep, 2018

1 commit


16 Aug, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - verify depmod is installed before modules_install

    - support build salt in case build ids must be unique between builds

    - allow users to specify additional host compiler flags via HOST*FLAGS,
    and rename internal variables to KBUILD_HOST*FLAGS

    - update buildtar script to drop vax support, add arm64 support

    - update builddeb script for better debarch support

    - document the pit-fall of if_changed usage

    - fix parallel build of UML with O= option

    - make 'samples' target depend on headers_install to fix build errors

    - remove deprecated host-progs variable

    - add a new coccinelle script for refcount_t vs atomic_t check

    - improve double-test coccinelle script

    - misc cleanups and fixes

    * tag 'kbuild-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits)
    coccicheck: return proper error code on fail
    Coccinelle: doubletest: reduce side effect false positives
    kbuild: remove deprecated host-progs variable
    kbuild: make samples really depend on headers_install
    um: clean up archheaders recipe
    kbuild: add %asm-generic to no-dot-config-targets
    um: fix parallel building with O= option
    scripts: Add Python 3 support to tracing/draw_functrace.py
    builddeb: Add automatic support for sh{3,4}{,eb} architectures
    builddeb: Add automatic support for riscv* architectures
    builddeb: Add automatic support for m68k architecture
    builddeb: Add automatic support for or1k architecture
    builddeb: Add automatic support for sparc64 architecture
    builddeb: Add automatic support for mips{,64}r6{,el} architectures
    builddeb: Add automatic support for mips64el architecture
    builddeb: Add automatic support for ppc64 and powerpcspe architectures
    builddeb: Introduce functions to simplify kconfig tests in set_debarch
    builddeb: Drop check for 32-bit s390
    builddeb: Change architecture detection fallback to use dpkg-architecture
    builddeb: Skip architecture detection when KBUILD_DEBARCH is set
    ...

    Linus Torvalds
     

18 Jul, 2018

1 commit

  • Commit 8370edea81e3 ("bin2c: move bin2c in scripts/basic") moved bin2c
    to the scripts/basic/ directory, incorrectly stating "Kexec wants to
    use bin2c and it wants to use it really early in the build process.
    See arch/x86/purgatory/ code in later patches."

    Commit bdab125c9301 ("Revert "kexec/purgatory: Add clean-up for
    purgatory directory"") and commit d6605b6bbee8 ("x86/build: Remove
    unnecessary preparation for purgatory") removed the redundant
    purgatory build magic entirely.

    That means that the move of bin2c was unnecessary in the first place.

    fixdep is the only host program that deserves to sit in the
    scripts/basic/ directory.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

06 Jul, 2018

3 commits

  • Currently there are some variables in the purgatory (e.g. kernel_entry)
    which are defined twice, once in assembler- and once in c-code. The reason
    for this is that these variables are set during purgatory load, where
    sanity checks on the corresponding Elf_Sym's are made, while they are used
    in assembler-code. Thus adding a second definition in c-code is a handy
    workaround to guarantee correct Elf_Sym's are created.

    When the purgatory is compiled with -fcommon (default for gcc on s390) this
    is no problem because both symbols are merged by the linker. However this
    is not required by ISO C and when the purgatory is built with -fno-common
    the linker fails with errors like

    arch/s390/purgatory/purgatory.o:(.bss+0x18): multiple definition of `kernel_entry'
    arch/s390/purgatory/head.o:/.../arch/s390/purgatory/head.S:230: first defined here

    Thus remove the duplicate definitions and add the required size and type
    information to the assembler definition. Also add -fno-common to the
    command line options to prevent similar hacks in the future.

    Signed-off-by: Philipp Rudo
    Acked-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     
  • Without FORCE make does not detect changes only made to the command line
    options. So object files might not be re-built even when they should be.
    Fix this by adding FORCE where it is missing.

    Fixes: 840798a1f5299 ("s390/kexec_file: Add purgatory")
    Cc: # 4.17
    Signed-off-by: Philipp Rudo
    Acked-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     
  • When the kernel is built with CONFIG_EXPOLINE=y and a compiler with
    indirect branch mitigation enabled the purgatory crashes. The reason for
    that is that the macros defined for expoline are used in mem.S. These
    macros define new sections (.text.__s390x_indirect_*) which are marked
    executable. Due to the missing linker script those sections are linked to
    address 0, just as the .text section. In combination with the entry point
    also being at address 0 this causes the purgatory load code
    (kernel/kexec_file.c: kexec_purgatory_setup_sechdrs) to update the entry
    point twice. Thus the old kernel jumps to some 'random' address causing the
    crash.

    To fix this turn off expolines for the purgatory. There is no problem with
    this in this case due to the fact that the purgatory only runs once and the
    tlb is purged (diag 308) in the end.

    Fixes: 840798a1f5299 ("s390/kexec_file: Add purgatory")
    Cc: # 4.17
    Signed-off-by: Philipp Rudo
    Reviewed-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     

18 May, 2018

1 commit

  • New compilers use the floating-point registers as spill registers when
    there is high register pressure. In the purgatory however, the afp control
    bit is not set. This leads to an exception whenever a floating-point
    instruction is used, which again causes an interrupt loop.

    Forbid the compiler to use floating-point instructions by adding
    -msoft-float to KBUILD_CFLAGS.

    Signed-off-by: Philipp Rudo
    Fixes: 840798a1f529 (s390/kexec_file: Add purgatory)
    Reviewed-by: Hendrik Brueckner
    Signed-off-by: Martin Schwidefsky

    Philipp Rudo
     

16 Apr, 2018

3 commits