[Crash-utility][PATCH V3 2/9] RISCV64: Make crash tool enter command line and support some commands

2022-08-12 Thread Xianting Tian
1. Add riscv64_init() implementation, do all necessary machine-specific setup, which will be called multiple times during initialization. 2. Add riscv64 sv39/48/57 pagetable macro definitions, the function of converting virtual address to a physical address via 4K page table. For 2M and

[Crash-utility][PATCH V3 7/9] RISCV64: Add 'help -m/M' command support

2022-08-12 Thread Xianting Tian
Add riscv64_dump_machdep_table() implementation, display machdep_table. crash> help -m flags: 80 () kvbase: ff60 identity_map_base: ff60 pagesize: 4096 pageshift: 12 pagemask: f000

[Crash-utility][PATCH V3 1/9] Add RISCV64 framework code support

2022-08-12 Thread Xianting Tian
This patch mainly added some environment configurations, macro definitions, specific architecture structures and some function declarations supported by the RISCV64 architecture. We can use the build command to get the simplest version crash tool: make target=RISCV64 -j2 Co-developed-by:

[Crash-utility][PATCH V3 6/9] RISCV64: Add 'help -r' command support

2022-08-12 Thread Xianting Tian
Add support form printing out the registers from the dump file. With the patch, we can get the regs, crash> help -r CPU 0: epc : 00ffa5537400 ra : 80088620 sp : ff201039bb90 gp : 810dde38 tp : ff6002269600 t0 : 8032be5c t1 : 0720072007200720 t2 :

[Crash-utility][PATCH V3 9/9] RISCV64: Add the implementation of symbol verify

2022-08-12 Thread Xianting Tian
Verify the symbol to accept or reject a symbol from the kernel namelist. Signed-off-by: Xianting Tian --- riscv64.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/riscv64.c b/riscv64.c index 0e5c9c6..cbb57f2 100644 --- a/riscv64.c +++ b/riscv64.c @@ -165,10

[Crash-utility][PATCH V3 5/9] RISCV64: Add 'bt' command support

2022-08-12 Thread Xianting Tian
1, Add the implementation to get stack frame from active & inactive task's stack. 2, Add 'bt -l' command support get a line number associated with a current pc address. 3, Add 'bt -f' command support to display all stack data contained in a frame With the patch, we can get the backtrace,

[Crash-utility][PATCH V3 0/9] Support RISCV64 arch and common commands

2022-08-12 Thread Xianting Tian
This series of patches are for Crash-utility tool, it make crash tool support RISCV64 arch and the common commands(*, bt, p, rd, mod, log, set, struct, task, dis, help -r, help -m, and so on). To make the crash tool work normally for RISCV64 arch, we need a Linux kernel patch, which exports the

[Crash-utility][PATCH V3 3/9] RISCV64: Add 'dis' command support

2022-08-12 Thread Xianting Tian
Use generic_dis_filter() function to support dis command implementation. With this patch, we can get the disassembled code, crash> dis __crash_kexec 0x80088580 <__crash_kexec>: addisp,sp,-352 0x80088582 <__crash_kexec+2>: sd s0,336(sp) 0x80088584

[Crash-utility][PATCH V3 8/9] RISCV64: Add 'mach' command support

2022-08-12 Thread Xianting Tian
With the patch we can get some basic machine state information, crash> mach MACHINE TYPE: riscv64 MEMORY SIZE: 1 GB CPUS: 1 PROCESSOR SPEED: (unknown) HZ: 250 PAGE SIZE: 4096

[Crash-utility][PATCH V3 4/9] RISCV64: Add 'irq' command support

2022-08-12 Thread Xianting Tian
With the patch, we can get the irq info, crash> irq IRQ IRQ_DESC/_DATA IRQACTION NAME 0 (unused) (unused) 1 ff6001329600 ff6001d17180 "101000.rtc" 2 ff6001329800 ff6001d17680 "ttyS0" 3 ff6001329a00 ff6001c33c00 "virtio0" 4

Re: [PATCH v10 8/8] x86/crash: Add x86 crash hotplug support

2022-08-12 Thread Baoquan He
On 07/21/22 at 02:17pm, Eric DeVolder wrote: ...snip > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index e58798f636d4..bb59596c8bea 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -2065,6 +2065,17 @@ config CRASH_DUMP > (CONFIG_RELOCATABLE=y). > For more

Re: [PATCH v10 1/8] crash: introduce arch/*/asm/crash.h

2022-08-12 Thread Baoquan He
On 08/12/22 at 04:23pm, Eric DeVolder wrote: > > > On 8/12/22 04:46, Baoquan He wrote: > > On 08/08/22 at 10:18am, Eric DeVolder wrote: > > > > > > > > > On 8/7/22 22:25, Baoquan He wrote: > > > > Hi Eric, > > > > > > > > On 07/21/22 at 02:17pm, Eric DeVolder wrote: > > > > > The use of

Re: [PATCH v10 1/8] crash: introduce arch/*/asm/crash.h

2022-08-12 Thread Eric DeVolder
On 8/12/22 04:46, Baoquan He wrote: On 08/08/22 at 10:18am, Eric DeVolder wrote: On 8/7/22 22:25, Baoquan He wrote: Hi Eric, On 07/21/22 at 02:17pm, Eric DeVolder wrote: The use of __weak is being eliminated within kexec sources. The technique uses macros mapped onto inline functions in

Re: [PATCH v7 3/6] x86/kexec: Carry forward IMA measurement log on kexec

2022-08-12 Thread Borislav Petkov
On Fri, Aug 12, 2022 at 01:14:38PM -0400, Stefan Berger wrote: > Yes, so this series can be tested by krobot. You mean Intel's 0day robot? I believe that thing has by now enough logic to figure out which branch to base patches ontop. Or maybe there's some magic incantation to tell it which base

Re: [PATCH v7 3/6] x86/kexec: Carry forward IMA measurement log on kexec

2022-08-12 Thread Stefan Berger
On 8/12/22 13:10, Borislav Petkov wrote: On Fri, Aug 12, 2022 at 12:43:02PM -0400, Stefan Berger wrote: From: Jonathan McDowell On kexec file load, the Integrity Measurement Architecture (IMA) subsystem may verify the IMA signature of the kernel and initramfs, and measure it. The command

Re: [PATCH v7 3/6] x86/kexec: Carry forward IMA measurement log on kexec

2022-08-12 Thread Borislav Petkov
On Fri, Aug 12, 2022 at 12:43:02PM -0400, Stefan Berger wrote: > From: Jonathan McDowell > > On kexec file load, the Integrity Measurement Architecture (IMA) > subsystem may verify the IMA signature of the kernel and initramfs, and > measure it. The command line parameters passed to the kernel

[PATCH v7 1/6] of: check previous kernel's ima-kexec-buffer against memory bounds

2022-08-12 Thread Stefan Berger
From: Vaibhav Jain Presently ima_get_kexec_buffer() doesn't check if the previous kernel's ima-kexec-buffer lies outside the addressable memory range. This can result in a kernel panic if the new kernel is booted with 'mem=X' arg and the ima-kexec-buffer was allocated beyond that range by the

[PATCH v7 2/6] drivers: of: kexec ima: Support 32-bit platforms

2022-08-12 Thread Stefan Berger
From: Palmer Dabbelt RISC-V recently added kexec_file() support, which uses enables kexec IMA. We're the first 32-bit platform to support this, so we found a build bug. Acked-by: Rob Herring Signed-off-by: Palmer Dabbelt Reviewed-by: Mimi Zohar --- drivers/of/kexec.c | 4 ++-- 1 file

[PATCH v7 4/6] tpm: of: Make of-tree specific function commonly available

2022-08-12 Thread Stefan Berger
Simplify tpm_read_log_of() by moving reusable parts of the code into an inline function that makes it commonly available so it can be used also for kexec support. Call the new of_tpm_get_sml_parameters() function from the TPM Open Firmware driver. Signed-off-by: Stefan Berger Cc: Jarkko Sakkinen

[PATCH v7 5/6] of: kexec: Refactor IMA buffer related functions to make them reusable

2022-08-12 Thread Stefan Berger
Refactor IMA buffer related functions to make them reusable for carrying TPM logs across kexec. Signed-off-by: Stefan Berger Cc: Rob Herring Cc: Frank Rowand Cc: Mimi Zohar Reviewed-by: Mimi Zohar Reviewed-by: Rob Herring Tested-by: Nageswara R Sastry --- v6: - Add __init to

[PATCH v7 6/6] tpm/kexec: Duplicate TPM measurement log in of-tree for kexec

2022-08-12 Thread Stefan Berger
The memory area of the TPM measurement log is currently not properly duplicated for carrying it across kexec when an Open Firmware Devicetree is used. Therefore, the contents of the log get corrupted. Fix this for the kexec_file_load() syscall by allocating a buffer and copying the contents of the

[PATCH v7 3/6] x86/kexec: Carry forward IMA measurement log on kexec

2022-08-12 Thread Stefan Berger
From: Jonathan McDowell On kexec file load, the Integrity Measurement Architecture (IMA) subsystem may verify the IMA signature of the kernel and initramfs, and measure it. The command line parameters passed to the kernel in the kexec call may also be measured by IMA. A remote attestation

[PATCH v7 0/6] tpm: Preserve TPM measurement log across kexec (ppc64)

2022-08-12 Thread Stefan Berger
The of-tree subsystem does not currently preserve the IBM vTPM 1.2 and vTPM 2.0 measurement logs across a kexec on PowerVM and PowerKVM. This series fixes this for the kexec_file_load() syscall using the flattened device tree (fdt) to carry the TPM measurement log's buffer across kexec. Stefan

Re: [PATCH v10 1/8] crash: introduce arch/*/asm/crash.h

2022-08-12 Thread Baoquan He
On 08/08/22 at 10:18am, Eric DeVolder wrote: > > > On 8/7/22 22:25, Baoquan He wrote: > > Hi Eric, > > > > On 07/21/22 at 02:17pm, Eric DeVolder wrote: > > > The use of __weak is being eliminated within kexec sources. > > > The technique uses macros mapped onto inline functions in > > > order