Re: [PATCH 14/17] s390/kexec_file: Add kexec_file_load system call

2018-02-12 Thread Philippe Ombredanne
On Mon, Feb 12, 2018 at 11:07 AM, Philipp Rudo wrote: > This patch adds the kexec_file_load system call to s390 as well as the arch > specific functions common code requires to work. Loaders for the different > file types will be added later. > > Signed-off-by: Philipp

[PATCH 06/17] kexec_file: Split up __kexec_load_puragory

2018-02-12 Thread Philipp Rudo
When inspecting __kexec_load_purgatory you find that it has two tasks 1) setting up the kexec_buffer for the new kernel and, 2) setting up pi->sechdrs for the final load address. The two tasks are independent of each other. To improve readability split up __kexec_load_purgatory

[PATCH 10/17] kexec_file: Allow archs to set purgatory load address

2018-02-12 Thread Philipp Rudo
For s390 new kernels are loaded to fixed addresses in memory before they are booted. With the current code this is a problem as it assumes the kernel will be loaded to an 'arbitrary' address. In particular, kexec_locate_mem_hole searches for a large enough memory region and sets the load address

[PATCH 05/17] kexec_file: Use read-only sections in arch_kexec_apply_relocations*

2018-02-12 Thread Philipp Rudo
When the relocations are applied to the purgatory only the section the relocations are applied to is writable. The other sections, i.e. the symtab and .rel/.rela, are in read-only kexec_purgatory. Highlight this by marking the corresponding variables as 'const'. While at it also change the

[PATCH 17/17] s390/kexec_file: Add ELF loader

2018-02-12 Thread Philipp Rudo
Add an ELF loader for kexec_file. The main task here is to do proper sanity checks on the ELF file. Basically all other functionality was already implemented for the image loader. Signed-off-by: Philipp Rudo --- arch/s390/include/asm/kexec.h | 1 +

[PATCH 03/17] kexec_file: Make purgatory_info->ehdr const

2018-02-12 Thread Philipp Rudo
The kexec_purgatory buffer is read-only. Thus all pointers into kexec_purgatory are read-only, too. Point this out by explicitly marking purgatory_info->ehdr as 'const' and update the comments in purgatory_info. Signed-off-by: Philipp Rudo --- include/linux/kexec.h |

[PATCH 12/17] s390/kexec_file: Prepare setup.h for kexec_file_load

2018-02-12 Thread Philipp Rudo
kexec_file_load needs to prepare the new kernels before they are loaded. For that it has to know the offsets in head.S, e.g. to register the new command line. Unfortunately there are no macros right now defining those offsets. Define them now. Signed-off-by: Philipp Rudo

[PATCH 11/17] kexec_file: Move purgatories sha256 to common code

2018-02-12 Thread Philipp Rudo
The code to verify the new kernels sha digest are applicable for all architectures. Move it to common code. Signed-off-by: Philipp Rudo --- arch/x86/purgatory/Makefile| 3 +++ arch/x86/purgatory/purgatory.c | 2 +-

[PATCH 14/17] s390/kexec_file: Add kexec_file_load system call

2018-02-12 Thread Philipp Rudo
This patch adds the kexec_file_load system call to s390 as well as the arch specific functions common code requires to work. Loaders for the different file types will be added later. Signed-off-by: Philipp Rudo --- arch/s390/Kconfig | 4 +

[PATCH 15/17] s390/kexec_file: Add image loader

2018-02-12 Thread Philipp Rudo
Add an image loader for kexec_file_load. For simplicity first skip crash support. The functions defined in machine_kexec_file will later be shared with the ELF loader. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky ---

[PATCH 09/17] kexec_file: Remove mis-use of sh_offset field

2018-02-12 Thread Philipp Rudo
The current code uses the sh_offset field in purgatory_info->sechdrs to store a pointer to the current load address of the section. Depending whether the section will be loaded or not this is either a pointer into purgatory_info->purgatory_buf or kexec_purgatory. This is not only a violation of

[PATCH 00/17] Add kexec_file_load support to s390

2018-02-12 Thread Philipp Rudo
Hi everybody resending the series as there was no reaction, yet. Furthermore i was told that Andrew and the x86 list should also be CCed, so welcome. No changes made to the patches since first time i sent them. The patches apply to the current master (v4.16-rc1). Thanks Philipp --- this

[PATCH 16/17] s390/kexec_file: Add crash support to image loader

2018-02-12 Thread Philipp Rudo
Add support to load a crash kernel to the image loader. This requires extending the purgatory. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- arch/s390/kernel/kexec_image.c| 6 +- arch/s390/kernel/machine_kexec_file.c

[PATCH 13/17] s390/kexec_file: Add purgatory

2018-02-12 Thread Philipp Rudo
The common code expects the architecture to have a purgatory that runs between the two kernels. Add it now. For simplicity first skip crash support. Signed-off-by: Philipp Rudo --- arch/s390/Kbuild | 1 + arch/s390/include/asm/purgatory.h | 17 +++

[PATCH 07/17] kexec_file: Simplify kexec_purgatory_setup_sechdrs 1

2018-02-12 Thread Philipp Rudo
To update the entry point there is an extra loop over all section headers although this can be done in the main loop. So move it there and eliminate the extra loop and variable to store the 'entry section index'. Also, in the main loop, move the usual case, i.e. non-bss section, out of the extra

[PATCH 04/17] kexec_file: Search symbols in read-only kexec_purgatory

2018-02-12 Thread Philipp Rudo
The stripped purgatory does not contain a symtab. So when looking for symbols this is done in read-only kexec_purgatory. Highlight this by marking the corresponding variables as 'const'. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 38

[PATCH 02/17] kexec_file: Remove checks in kexec_purgatory_load

2018-02-12 Thread Philipp Rudo
Before the purgatory is loaded several checks are done whether the ELF file in kexec_purgatory is valid or not. These checks are incomplete. For example they don't check for the total size of the sections defined in the section header table or if the entry point actually points into the purgatory.

[PATCH 01/17] kexec_file: Silence compile warnings

2018-02-12 Thread Philipp Rudo
When building the kernel with CONFIG_KEXEC_FILE enabled gcc prints a compile warning multiple times. In file included from /linux/init/initramfs.c:526:0: /include/linux/kexec.h:120:9: warning: ‘struct kimage’ declared inside parameter list [enabled by default] unsigned long

[PATCH 08/17] kexec_file: Simplify kexec_purgatory_setup_sechdrs 2

2018-02-12 Thread Philipp Rudo
The main loop currently uses quite a lot of variables to update the section headers. Some of them are unnecessary. So clean them up a little. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 34 -- 1 file changed, 12 insertions(+),

Re: [PATCH 14/17] s390/kexec_file: Add kexec_file_load system call

2018-02-12 Thread Philipp Rudo
On Mon, 12 Feb 2018 11:56:25 +0100 Philippe Ombredanne wrote: > On Mon, Feb 12, 2018 at 11:07 AM, Philipp Rudo > wrote: > > This patch adds the kexec_file_load system call to s390 as well as the arch > > specific functions common code requires to