Re: [PATCH 1/7] kexec_file: add kexec_file flag to control debug printing

2023-11-14 Thread Baoquan He
On 11/14/23 at 08:03am, Joe Perches wrote: > On Tue, 2023-11-14 at 23:32 +0800, Baoquan He wrote: > > When specifying 'kexec -c -d', kexec_load interface will print loading > > information, e.g the regions where kernel/initrd/purgatory/cmdline > > are put, the memmap passed to 2nd kernel taken as

Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()

2023-11-14 Thread Baoquan He
On 11/14/23 at 03:17pm, Andrew Morton wrote: > On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He wrote: > > > This function, being a variant of walk_system_ram_res() introduced in > > commit 8c86e70acead ("resource: provide new functions to walk through > > resources"), walks through a list of all

Re: [PATCH v2 0/7] ima: kexec: measure events between kexec load and execute

2023-11-14 Thread Tushar Sugandhi
On 10/27/23 08:18, Mimi Zohar wrote: On Thu, 2023-10-05 at 11:25 -0700, Tushar Sugandhi wrote: The current Kernel behavior is IMA measurements snapshot is taken at kexec 'load' and not at kexec 'execute'. IMA log is then carried over to the new Kernel after kexec 'execute'. Some systems

Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()

2023-11-14 Thread Andrew Morton
On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He wrote: > This function, being a variant of walk_system_ram_res() introduced in > commit 8c86e70acead ("resource: provide new functions to walk through > resources"), walks through a list of all the resources of System RAM > in reversed order, i.e.,

Re: [PATCH v2 7/7] ima: record log size at kexec load and execute

2023-11-14 Thread Tushar Sugandhi
On 10/27/23 07:56, Mimi Zohar wrote: Hi Tushar, On Thu, 2023-10-05 at 11:26 -0700, Tushar Sugandhi wrote: The window between kexec 'load' and 'execute' could be arbitrarily long. Even with the large chunk of memory allocated at kexec 'load', it may run out which would result in missing

Re: [PATCH v2 2/7] ima: move ima_dump_measurement_list call from kexec load to execute

2023-11-14 Thread Tushar Sugandhi
On 10/27/23 06:08, Mimi Zohar wrote: Hi Tushar, On Thu, 2023-10-05 at 11:25 -0700, Tushar Sugandhi wrote: In the current IMA implementation, ima_dump_measurement_list() is called during the kexec 'load' operation. This can result in loss of IMA measurements taken between the 'load' and

Re: [PATCH v2 1/7] ima: refactor ima_dump_measurement_list to move memory allocation to a separate function

2023-11-14 Thread Tushar Sugandhi
On 10/26/23 20:25, Mimi Zohar wrote: On Thu, 2023-10-26 at 16:16 -0400, Mimi Zohar wrote: Hi Tushar, According to Documentation/process/submitting-patches.rst, the subject line should be between 70-75 characters. Perhaps something like "ima: define and call ima_alloc_kexec_buffer()". On

Re: [PATCH v2 1/7] ima: refactor ima_dump_measurement_list to move memory allocation to a separate function

2023-11-14 Thread Tushar Sugandhi
Thanks a lot for reviewing this patch set Mimi. On 10/26/23 13:16, Mimi Zohar wrote: Hi Tushar, According to Documentation/process/submitting-patches.rst, the subject line should be between 70-75 characters. Perhaps something like "ima: define and call ima_alloc_kexec_buffer()". Sure thing.

Re: [RFC V2] IMA Log Snapshotting Design Proposal

2023-11-14 Thread Stefan Berger
On 11/14/23 13:36, Sush Shringarputale wrote: On 11/13/2023 10:59 AM, Stefan Berger wrote: On 10/19/23 14:49, Tushar Sugandhi wrote: === | Introduction |

Re: [RFC V2] IMA Log Snapshotting Design Proposal

2023-11-14 Thread Sush Shringarputale
On 11/13/2023 10:59 AM, Stefan Berger wrote: On 10/19/23 14:49, Tushar Sugandhi wrote: === | Introduction | === This document provides a detailed overview

[PATCH] kexec: Use atomic_try_cmpxchg in crash_kexec

2023-11-14 Thread Uros Bizjak
Use atomic_try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in crash_kexec(). x86 CMPXCHG instruction returns success in ZF flag, so this change saves a compare after cmpxchg. No functional change intended. Cc: Eric Biederman Signed-off-by: Uros Bizjak --- kernel/kexec_core.c | 5 +++--

Re: [PATCH 1/7] kexec_file: add kexec_file flag to control debug printing

2023-11-14 Thread Joe Perches
On Tue, 2023-11-14 at 23:32 +0800, Baoquan He wrote: > When specifying 'kexec -c -d', kexec_load interface will print loading > information, e.g the regions where kernel/initrd/purgatory/cmdline > are put, the memmap passed to 2nd kernel taken as system RAM ranges, > and printing all contents of

[PATCH 7/7] kexec_file, parisc: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/parisc/kernel/kexec_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/parisc/kernel/kexec_file.c b/arch/parisc/kernel/kexec_file.c

[PATCH 4/7] kexec_file, arm64: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove the kimage->segment[] printing because the generic code has done the printing. Signed-off-by: Baoquan He --- arch/arm64/kernel/kexec_image.c| 2 +-

[PATCH 6/7] kexec_file, power: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/powerpc/kexec/elf_64.c | 8 arch/powerpc/kexec/file_load_64.c | 14 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git

[PATCH 3/7] kexec_file, x86: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out e820 memmap passed to 2nd kernel just as kexec_load interface has been doing. Signed-off-by: Baoquan He --- arch/x86/kernel/crash.c | 2 +-

[PATCH 0/7] kexec_file: print out debugging message if required

2023-11-14 Thread Baoquan He
Currently, specifying '-d' will print a lot of debugging information about kexec/kdump loading with kexec_load interface. However, kexec_file_load prints nothing even though '-d' is specified. It's very inconvenient to debug or analyze the kexec/kdump loading when something wrong happened with

[PATCH 1/7] kexec_file: add kexec_file flag to control debug printing

2023-11-14 Thread Baoquan He
When specifying 'kexec -c -d', kexec_load interface will print loading information, e.g the regions where kernel/initrd/purgatory/cmdline are put, the memmap passed to 2nd kernel taken as system RAM ranges, and printing all contents of struct kexec_segment, etc. These are very helpful for

[PATCH 2/7] kexec_file: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out type/start/head of kimage and flags to help debug. Signed-off-by: Baoquan He --- kernel/crash_core.c| 3 ++- kernel/kexec_file.c| 7 ++-

[PATCH 5/7] kexec_file, ricv: print out debugging message if required

2023-11-14 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove kexec_image_info() because the content has been printed out in generic code. Signed-off-by: Baoquan He --- arch/riscv/kernel/elf_kexec.c | 9 +

[PATCH] kexec_file: add kexec_file flag to support debug printing

2023-11-14 Thread Baoquan He
This add KEXEC_FILE_DEBUG to kexec_file_flags so that it can be passed to kernel when '-d' is added with kexec_file_load interface. With that flag enabled, kernel can enable the debugging message printing. Signed-off-by: Baoquan He --- kexec/kexec-syscall.h | 1 + kexec/kexec.c | 1 + 2

Re: [PATCH] x86/kexec: set MIN_KERNEL_LOAD_ADDR to 0x01000000

2023-11-14 Thread Baoquan He
Hi John, On 10/23/23 at 02:54pm, John Sperbeck wrote: > On Sun, Oct 22, 2023 at 7:42 PM H. Peter Anvin wrote: .. > > >--- > > > arch/x86/kernel/kexec-bzimage64.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > >diff --git a/arch/x86/kernel/kexec-bzimage64.c > >

[PATCH 2/2] kexec_file: Load kernel at top of system RAM if required

2023-11-14 Thread Baoquan He
Kexec_load interface has been doing top down searching and loading kernel/initrd/purgtory etc to prepare for kexec reboot. In that way, the benefits are that it avoids to consume and fragment limited low memory which satisfy DMA buffer allocation and big chunk of continuous memory during system

[PATCH 0/2] kexec_file: Load kernel at top of system RAM if required

2023-11-14 Thread Baoquan He
Justification: == Kexec_load interface has been doing top down searching and loading kernel/initrd/purgtory etc to prepare for kexec reboot. In that way, the benefits are that it avoids to consume and fragment limited low memory which satisfy DMA buffer allocation and big chunk of

[PATCH 1/2] resource: add walk_system_ram_res_rev()

2023-11-14 Thread Baoquan He
This function, being a variant of walk_system_ram_res() introduced in commit 8c86e70acead ("resource: provide new functions to walk through resources"), walks through a list of all the resources of System RAM in reversed order, i.e., from higher to lower. It will be used in kexec_file code to