Re: [PATCH] Only allow to set crash_kexec_post_notifiers on boot time

2020-09-29 Thread Philipp Rudo
Hi, On Fri, 25 Sep 2020 10:56:25 -0400 Konrad Rzeszutek Wilk wrote: > On Fri, Sep 25, 2020 at 11:05:58AM +0800, Dave Young wrote: > > Hi, > > > > On 09/24/20 at 01:16pm, boris.ostrov...@oracle.com wrote: > > > > > > On 9/24/20 12:43 PM, Michael Kelley wrote: > > > > From: Eric W. Biederman

Re: [PATCH] Only allow to set crash_kexec_post_notifiers on boot time

2020-09-22 Thread Philipp Rudo
Hi Konrad, On Mon, 21 Sep 2020 16:18:12 -0400 Konrad Rzeszutek Wilk wrote: > On Fri, Sep 18, 2020 at 05:47:43PM -0700, Andrew Morton wrote: > > On Fri, 18 Sep 2020 11:25:46 +0800 Dave Young wrote: > > > > > crash_kexec_post_notifiers enables running various panic notifier > > > before kdump

Re: [PATCH RFC 1/2] s390/zcore: traverse resources instead of memblocks

2020-06-19 Thread Philipp Rudo
gt; Result with this patch: > > root@vm0:~# cat /sys/kernel/debug/zcore/memmap > > 3000 3000 1000 > > > > The difference is due to memblocks getting merged, resources (currently) > > not. So we might have some more ent

Re: s390x: kdump kernel can not boot if I load kernel and initrd images via the kexec_file_load syscall.

2020-05-12 Thread Philipp Rudo
Hi Lianbo, stupid me obviously never tested the kdump+initrd combination... The patch below fixed the problem for me. Could please give it a try, too. Thanks Philipp --- >From 3f77088c9139582261d2e3ee6476324fc1ded401 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 12 May 2020 19:25

Re: [RFC v2 0/1] s390/purgatory: Make sure we fail the build if purgatory has missing symbols

2019-10-09 Thread Philipp Rudo
Hi Hans, also adding Ingo on Cc. I tested you patch on s390 and it does what it's supposed to do. The build now fails with LD arch/s390/purgatory/purgatory.chk arch/s390/purgatory/purgatory: In function `sha256_update': (.text+0x3bc2): undefined reference to `memzero_explicit' /home/prud

Re: [PATCH v1 0/2] kexec: Remove "weak" annotations from headers

2018-04-13 Thread Philipp Rudo
Hi Bjorn, in recent patches AKASHI [1] and I [2] made some changes to the declarations you are touching and already removed some of the weak statements. The patches got accepted on linux-next and will (hopefully) be pulled for v4.17. So you should prepare for some merge conflicts. Nevertheless thr

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

2018-03-23 Thread Philipp Rudo
Hi Andrew, Hi Dave, i checked out linux-next with the patches and it looks good to me. Also made a quick test and everything works fine. Thanks very much to both of you Philipp On Wed, 21 Mar 2018 16:00:42 -0700 Andrew Morton wrote: > On Wed, 21 Mar 2018 12:27:40 +0100 Philipp Rudo >

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

2018-03-21 Thread Philipp Rudo
d 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_purgator

[PATCH v2 02/11] kexec_file: Remove checks in kexec_purgatory_load

2018-03-21 Thread Philipp Rudo
atory. On the other hand the purgatory, although an ELF file on its own, is part of the kernel. Thus not trusting the purgatory means not trusting the kernel build itself. So remove all validity checks on the purgatory and just trust the kernel build. Signed-off-by: Philipp Rudo --- k

[PATCH v2 06/11] kexec_file: Split up __kexec_load_puragory

2018-03-21 Thread Philipp Rudo
ory into two functions, one for each task, and call them directly from kexec_load_purgatory. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 200 +++- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/kernel/kexec_file.c b/ker

[PATCH v2 01/11] kexec_file: Silence compile warnings

2018-03-21 Thread Philipp Rudo
); ^ This is because the typedefs for kexec_file_load uses struct kimage before it is declared. Fix this by simply forward declaring struct kimage. Signed-off-by: Philipp Rudo --- include/linux/kexec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/kexec.h b/include

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

2018-03-21 Thread Philipp Rudo
change the signatures of arch_kexec_apply_relocations* to take section pointers instead of just the index of the relocation section. This removes the second lookup and sanity check of the sections in arch code. Signed-off-by: Philipp Rudo --- arch/x86/kernel/machine_kexec

[PATCH v2 07/11] kexec_file: Remove unneeded for-loop in kexec_purgatory_setup_sechdrs

2018-03-21 Thread Philipp Rudo
the extra if-block. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- kernel/kexec_file.c | 76 + 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index d1c3ec8dc6b1..49

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

2018-03-21 Thread Philipp Rudo
common code and changing the include to linux/string.h both functions are no longer defined. Thus definitions have to be provided in x86/purgatory/string.c Signed-off-by: Philipp Rudo --- arch/x86/purgatory/Makefile| 3 +++ arch/x86/purgatory/purgatory.c | 2

[PATCH v2 08/11] kexec_file: Remove unneeded variables in kexec_purgatory_setup_sechdrs

2018-03-21 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(+), 22 deletions(-) diff

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

2018-03-21 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 v2 03/11] kexec_file: Make purgatory_info->ehdr const

2018-03-21 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

[PATCH v2 09/11] kexec_file: Remove mis-use of sh_offset field during purgatory load

2018-03-21 Thread Philipp Rudo
ion of the ELF standard but also makes the code very hard to understand as you cannot tell if the memory you are using is read-only or not. Remove this mis-use and store the offset of the section in pugaroty_info->purgatory_buf in sh_offset. Signed-off-by: Philipp Rudo --- arch/x

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

2018-03-21 Thread Philipp Rudo
his change is that we can get rid of the purgatory_info->purgatory_load_address field. As now the information stored there can directly be accessed from kbuf->mem. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- arch/powerpc/kernel/kexec_elf_64.c | 9 + arch/x86/ker

Re: [PATCH 00/11] kexec_file: Clean up purgatory load

2018-03-20 Thread Philipp Rudo
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:40

Re: [PATCH 00/11] kexec_file: Clean up purgatory load

2018-03-15 Thread Philipp Rudo
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 > >

Re: [PATCH 00/11] kexec_file: Clean up purgatory load

2018-03-14 Thread Philipp Rudo
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

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

2018-03-12 Thread Philipp Rudo
On Mon, 12 Mar 2018 15:42:18 +0800 Dave Young wrote: > Hi Philipp, > On 03/09/18 at 11:02am, Philipp Rudo wrote: > > Hi Dave, > > > > > > On Fri, 9 Mar 2018 11:14:20 +0800 > > Dave Young wrote: > > > > > On 02/26/18 at 04:16pm, Phil

Re: [PATCH 00/11] kexec_file: Clean up purgatory load

2018-03-09 Thread Philipp Rudo
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 r

Re: [PATCH 00/11] kexec_file: Clean up purgatory load

2018-03-09 Thread Philipp Rudo
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

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

2018-03-09 Thread Philipp Rudo
Hi Dave, On Fri, 9 Mar 2018 12:43:53 +0800 Dave Young wrote: > On 02/26/18 at 04:16pm, Philipp Rudo wrote: > > The code to verify the new kernels sha digest are applicable for all > > architectures. Move it to common code. > > > > Signed-off-by: Philipp Rudo >

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

2018-03-09 Thread Philipp Rudo
Hi Dave, On Fri, 9 Mar 2018 11:14:20 +0800 Dave Young wrote: > On 02/26/18 at 04:16pm, Philipp Rudo wrote: > > 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 > > whe

Re: [PATCH 08/11] kexec_file: Simplify kexec_purgatory_setup_sechdrs 2

2018-03-09 Thread Philipp Rudo
Hi Dave, On Fri, 9 Mar 2018 11:18:05 +0800 Dave Young wrote: > Hi, > > On 02/26/18 at 04:16pm, Philipp Rudo wrote: > > 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. > &

Re: [PATCH v8 03/13] kexec_file, x86, powerpc: factor out kexec_file_ops functions

2018-02-27 Thread Philipp Rudo
On Tue, 27 Feb 2018 11:03:07 +0900 AKASHI Takahiro wrote: > On Mon, Feb 26, 2018 at 12:17:18PM +0100, Philipp Rudo wrote: > > Hi AKASHI > > > > On Thu, 22 Feb 2018 20:17:22 +0900 > > AKASHI Takahiro wrote: > > > > [...] > > > > >

[PATCH 01/11] kexec_file: Silence compile warnings

2018-02-26 Thread Philipp Rudo
); ^ This is because the typedefs for kexec_file_load uses struct kimage before it is declared. Fix this by simply forward declaring struct kimage. Signed-off-by: Philipp Rudo --- include/linux/kexec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/kexec.h b/include

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

2018-02-26 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 +- {arch/x86/purgatory => include/li

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

2018-02-26 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 06/11] kexec_file: Split up __kexec_load_puragory

2018-02-26 Thread Philipp Rudo
ory into two functions, one for each task, and call them directly from kexec_load_purgatory. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 200 +++- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/kernel/kexec_file.c b/ker

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

2018-02-26 Thread Philipp Rudo
ion of the ELF standard but also makes the code very hard to understand as you cannot tell if the memory you are using is read-only or not. Remove this mis-use and store the offset of the section in pugaroty_info->purgatory_buf in sh_offset. Signed-off-by: Philipp Rudo --- arch/x

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

2018-02-26 Thread Philipp Rudo
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_purg

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

2018-02-26 Thread Philipp Rudo
his change is that we can get rid of the purgatory_info->purgatory_load_address field. As now the information stored there can directly be accessed from kbuf->mem. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- arch/powerpc/kernel/kexec_elf_64.c | 9 + arch/x86/ker

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

2018-02-26 Thread Philipp Rudo
change the signatures of arch_kexec_apply_relocations* to take section pointers instead of just the index of the relocation section. This removes the second lookup and sanity check of the sections in arch code. Signed-off-by: Philipp Rudo --- arch/x86/kernel/machine_kexec

[PATCH 08/11] kexec_file: Simplify kexec_purgatory_setup_sechdrs 2

2018-02-26 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(+), 22 deletions(-) diff

[PATCH 07/11] kexec_file: Simplify kexec_purgatory_setup_sechdrs 1

2018-02-26 Thread Philipp Rudo
the extra if-block. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- kernel/kexec_file.c | 76 + 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index d1c3ec8dc6b1..bb

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

2018-02-26 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

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

2018-02-26 Thread Philipp Rudo
atory. On the other hand the purgatory, although an ELF file on its own, is part of the kernel. Thus not trusting the purgatory means not trusting the kernel build itself. So remove all validity checks on the purgatory and just trust the kernel build. Signed-off-by: Philipp Rudo --- k

Re: [PATCH v8 03/13] kexec_file,x86,powerpc: factor out kexec_file_ops functions

2018-02-26 Thread Philipp Rudo
On Mon, 26 Feb 2018 19:01:39 +0900 AKASHI Takahiro wrote: > On Fri, Feb 23, 2018 at 05:24:59PM +0800, Dave Young wrote: > > Hi AKASHI, > > > > On 02/22/18 at 08:17pm, AKASHI Takahiro wrote: > > > As arch_kexec_kernel_*_{probe,load}(), > > > arch_kimage_file_post_load_cleanup() > > > and arch_

Re: [PATCH v8 03/13] kexec_file, x86, powerpc: factor out kexec_file_ops functions

2018-02-26 Thread Philipp Rudo
Hi AKASHI On Thu, 22 Feb 2018 20:17:22 +0900 AKASHI Takahiro wrote: [...] > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index 990adae52151..a6d14a768b3e 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -26,34 +26,83 @@ > #include > #include "kexec_internal.h"

Re: [PATCH 00/17] Add kexec_file_load support to s390

2018-02-26 Thread Philipp Rudo
Hi Dave Hi AKASHI On Mon, 26 Feb 2018 10:21:02 +0900 AKASHI Takahiro wrote: > > > > Arch code need arch maintainer to review, maybe either of you can send > > the common part first before the arch code, eg. AKASHI can split the common > > cleanup patches and post them as a separate series, aft

Re: [PATCH 00/17] Add kexec_file_load support to s390

2018-02-23 Thread Philipp Rudo
Hi Dave On Fri, 23 Feb 2018 16:34:05 +0800 Dave Young wrote: > On 02/14/18 at 10:54am, Philipp Rudo wrote: > > Hi Dave, > > > > I just browsed AKASHI's patches (v7). The way I see it the common code > > changes > > are on different areas of kexec_file

Re: [PATCH 00/17] Add kexec_file_load support to s390

2018-02-14 Thread Philipp Rudo
ill need read the > details. > > On 02/12/18 at 11:07am, Philipp Rudo wrote: > > 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. > > > > N

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 work. Loaders for the differ

[PATCH 00/17] Add kexec_file_load support to s390

2018-02-12 Thread Philipp Rudo
Cross-compiling with defconfig(*) works fine for both. Thanks Philipp (*) On x86 with the orc unwinder turned off. objtool SEGFAULTs on s390... Philipp Rudo (17): kexec_file: Silence compile warnings kexec_file: Remove checks in kexec_purgatory_load kexec_file: Make purgatory_info->ehdr

[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 05/17] kexec_file: Use read-only sections in arch_kexec_apply_relocations*

2018-02-12 Thread Philipp Rudo
change the signatures of arch_kexec_apply_relocations* to take section pointers instead of just the index of the relocation section. This removes the second lookup and sanity check of the sections in arch code. Signed-off-by: Philipp Rudo --- arch/x86/kernel/machine_kexec

[PATCH 01/17] kexec_file: Silence compile warnings

2018-02-12 Thread Philipp Rudo
); ^ This is because the typedefs for kexec_file_load uses struct kimage before it is declared. Fix this by simply forward declaring struct kimage. Signed-off-by: Philipp Rudo --- include/linux/kexec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/kexec.h b/include

[PATCH 06/17] kexec_file: Split up __kexec_load_puragory

2018-02-12 Thread Philipp Rudo
ory into two functions, one for each task, and call them directly from kexec_load_purgatory. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 200 +++- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/kernel/kexec_file.c b/ker

[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(+), 22 deletions(-) diff

[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

[PATCH 07/17] kexec_file: Simplify kexec_purgatory_setup_sechdrs 1

2018-02-12 Thread Philipp Rudo
the extra if-block. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- kernel/kexec_file.c | 76 + 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index d1c3ec8dc6b1..bb

[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 --- arch/s390/include

[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 +- {arch/x86/purgatory => include/li

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

2018-02-12 Thread Philipp Rudo
his change is that we can get rid of the purgatory_info->purgatory_load_address field. As now the information stored there can directly be accessed from kbuf->mem. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- arch/powerpc/kernel/kexec_elf_64.c | 9 + arch/x86/ker

[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 --- arch/s390/include/asm/kexec.h | 22 ++ arch

[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 +++ arch/s390/kernel/asm

[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 | 45 - arch/s390/purgatory/head.S

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

2018-02-12 Thread Philipp Rudo
ion of the ELF standard but also makes the code very hard to understand as you cannot tell if the memory you are using is read-only or not. Remove this mis-use and store the offset of the section in pugaroty_info->purgatory_buf in sh_offset. Signed-off-by: Philipp Rudo --- arch/x

[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 + arch/s390/kernel/Makefile

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

2018-02-12 Thread Philipp Rudo
atory. On the other hand the purgatory, although an ELF file on its own, is part of the kernel. Thus not trusting the purgatory means not trusting the kernel build itself. So remove all validity checks on the purgatory and just trust the kernel build. Signed-off-by: Philipp Rudo --- k

[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 + arch/s390/kernel/Makefile

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

2018-02-02 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 +- {arch/x86/purgatory => include/li

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

2018-02-02 Thread Philipp Rudo
his change is that we can get rid of the purgatory_info->purgatory_load_address field. As now the information stored there can directly be accessed from kbuf->mem. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- arch/powerpc/kernel/kexec_elf_64.c | 9 + arch/x86/ker

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

2018-02-02 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 +++ arch/s390/kernel/asm

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

2018-02-02 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 --- arch/s390/include/asm/kexec.h | 22 ++ arch

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

2018-02-02 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 + arch/s390/kernel/Makefile

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

2018-02-02 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 --- arch/s390/include

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

2018-02-02 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 | 45 - arch/s390/purgatory/head.S

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

2018-02-02 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 + arch/s390/kernel/Makefile

[PATCH 08/17] kexec_file: Simplify kexec_purgatory_setup_sechdrs 2

2018-02-02 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(+), 22 deletions(-) diff

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

2018-02-02 Thread Philipp Rudo
ion of the ELF standard but also makes the code very hard to understand as you cannot tell if the memory you are using is read-only or not. Remove this mis-use and store the offset of the section in pugaroty_info->purgatory_buf in sh_offset. Signed-off-by: Philipp Rudo --- arch/x

[PATCH 01/17] kexec_file: Silence compile warnings

2018-02-02 Thread Philipp Rudo
); ^ This is because the typedefs for kexec_file_load uses struct kimage before it is declared. Fix this by simply forward declaring struct kimage. Signed-off-by: Philipp Rudo --- include/linux/kexec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/kexec.h b/include

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

2018-02-02 Thread Philipp Rudo
atory. On the other hand the purgatory, although an ELF file on its own, is part of the kernel. Thus not trusting the purgatory means not trusting the kernel build itself. So remove all validity checks on the purgatory and just trust the kernel build. Signed-off-by: Philipp Rudo --- k

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

2018-02-02 Thread Philipp Rudo
change the signatures of arch_kexec_apply_relocations* to take section pointers instead of just the index of the relocation section. This removes the second lookup and sanity check of the sections in arch code. Signed-off-by: Philipp Rudo --- arch/x86/kernel/machine_kexec

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

2018-02-02 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 06/17] kexec_file: Split up __kexec_load_puragory

2018-02-02 Thread Philipp Rudo
ory into two functions, one for each task, and call them directly from kexec_load_purgatory. Signed-off-by: Philipp Rudo --- kernel/kexec_file.c | 200 +++- 1 file changed, 103 insertions(+), 97 deletions(-) diff --git a/kernel/kexec_file.c b/ker

[PATCH 07/17] kexec_file: Simplify kexec_purgatory_setup_sechdrs 1

2018-02-02 Thread Philipp Rudo
the extra if-block. Signed-off-by: Philipp Rudo Reviewed-by: Martin Schwidefsky --- kernel/kexec_file.c | 76 + 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index d1c3ec8dc6b1..bb

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

2018-02-02 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

[PATCH 00/17] Add kexec_file_load support to s390

2018-02-02 Thread Philipp Rudo
t have a way to test it. Cross-compiling with defconfig(*) works fine for both. Thanks Philipp (*) On x86 with the orc unwinder turned off. objtool SEGFAULTs on s390... Philipp Rudo (17): kexec_file: Silence compile warnings kexec_file: Remove checks in kexec_purgatory_load kexec_file: Make