Re: [PATCH 2/4] arm64: Add ZBOOT PE containing compressed image support

2023-05-04 Thread Pingfan Liu
On Fri, May 5, 2023 at 12:44 AM Jeremy Linton wrote: > > The kernel EFI stub ZBOOT feature creates a PE that > contains a compressed linux kernel image. The stub > when run in a valid UEFI environment then decompresses > the resulting image and executes it. > > Support these image formats with

Re: [PATCH 4/4] arm64: Fix some issues with zImage _probe()

2023-05-04 Thread Pingfan Liu
On Fri, May 5, 2023 at 12:44 AM Jeremy Linton wrote: > > Current compilers note that fname will be null while > attempting to print failures from strdup(). > > Further fix a memory leak caused by kernel_uncompressed_buf > never being used/freed before the allocated block is replaced > by the one

Re: [PATCH 0/4] Support kexec'ing PEs containing compressed kernels

2023-05-04 Thread Pingfan Liu
Hi Jeremy, Thanks for sharing this. When I get your series, my series is close to end, so just post it. My 2/5 is identical to your 4/4, and can be dropped. My 5/5 is similar to your 2/4, which can be dropped either. The main difference is about the image probe method. Since the introduction of

[PATCH 2/5] arm64/zImage: Remove unnecessary allocation for kernel_uncompressed_buf

2023-05-04 Thread Pingfan Liu
Since slurp_decompress_file() allocates the buffer to hold the content read from the file, no need to allocate the buffer again. Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com ---

[PATCH 4/5] arm64: Scatter the reading of kernel file into each probe

2023-05-04 Thread Pingfan Liu
As more complicated capsule kernel format occurs like zboot, where the compressed kernel is stored as a payload. The straight forward decompression can not meet the demand. So reading in the kernel file in a probe file and decide how to unfold the content by the method itself. Signed-off-by:

[PATCH 4/5] arm64: Scatter the logic of reading of kernel file into each probe

2023-05-04 Thread Pingfan Liu
As more complicated capsule kernel format occurs like zboot, where the compressed kernel is stored as a payload. The straight forward decompression can not meet the demand. So reading in the kernel file in a probe method and decide how to unfold the content by the method itself. Signed-off-by:

[PATCH 3/5] arm64: change the prototype of image probe function

2023-05-04 Thread Pingfan Liu
Changing the aarch64 probe's prototype from typedef int (probe_t)(const char *kernel_buf, off_t kernel_size); to typedef int (probe_t)(const char *kernel_buf, off_t kernel_size, struct kexec_info *info); Later, info can be used to return both the file descriptor and parsed

[PATCH 1/5] kexec: Adding missing free for kernel_buf

2023-05-04 Thread Pingfan Liu
slurp_decompress_file() allocates memory but nowhere to free it. Adding that missing free. Signed-off-by: Pingfan Liu To: kexec@lists.infradead.org Cc: ho...@verge.net.au Cc: a...@kernel.org Cc: jeremy.lin...@arm.com --- kexec/kexec.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 0/5] arm64: zboot support

2023-05-04 Thread Pingfan Liu
As more complicated capsule kernel format occurs like zboot, where the compressed kernel is stored as a payload. The straight forward decompression can not meet the demand. As the first step, on aarch64, reading in the kernel file in a probe method and decide how to unfold the content by the

Re: [PATCH 0/4] Support kexec'ing PEs containing compressed kernels

2023-05-04 Thread Ard Biesheuvel
On Thu, 4 May 2023 at 18:41, Jeremy Linton wrote: > > The linux ZBOOT option creates PEs that contain compressed kernel images > which are self decompressed on execution by UEFI. > > This set adds support for this image format to kexec by decompressing the > contained kernel image to a temp file,

[PATCH 4/4] arm64: Fix some issues with zImage _probe()

2023-05-04 Thread Jeremy Linton
Current compilers note that fname will be null while attempting to print failures from strdup(). Further fix a memory leak caused by kernel_uncompressed_buf never being used/freed before the allocated block is replaced by the one returned by slurp_decompress_file(). Signed-off-by: Jeremy Linton

[PATCH 0/4] Support kexec'ing PEs containing compressed kernels

2023-05-04 Thread Jeremy Linton
The linux ZBOOT option creates PEs that contain compressed kernel images which are self decompressed on execution by UEFI. This set adds support for this image format to kexec by decompressing the contained kernel image to a temp file, then handing the resulting image off to the existing "Image"

[PATCH 2/4] arm64: Add ZBOOT PE containing compressed image support

2023-05-04 Thread Jeremy Linton
The kernel EFI stub ZBOOT feature creates a PE that contains a compressed linux kernel image. The stub when run in a valid UEFI environment then decompresses the resulting image and executes it. Support these image formats with kexec as well to avoid having to keep an alternate kernel image

[PATCH 3/4] arm64: Hook up the ZBOOT support as vmlinuz

2023-05-04 Thread Jeremy Linton
Add the previously defined _probe() and _usage() routines to the kexec file types table, and build the new module. It should be noted that this "vmlinuz" support reuses the "Image" support to actually load the resulting image after it has been decompressed to a temporary file. Signed-off-by:

[PATCH 1/4] arm64: Cleanup _probe() return values

2023-05-04 Thread Jeremy Linton
The decision to process a compressed image should be part of the image specific detection logic. As such lets clarify the return logic, and remove the is_zlib_file() logic in the main file type detection loop. Signed-off-by: Jeremy Linton --- kexec/arch/arm64/kexec-arm64.c | 6 ++

[PATCH v6 08/14] x86: Secure Launch kernel late boot stub

2023-05-04 Thread Ross Philipson
The routine slaunch_setup is called out of the x86 specific setup_arch routine during early kernel boot. After determining what platform is present, various operations specific to that platform occur. This includes finalizing setting for the platform late launch and verifying that memory

[PATCH v6 00/14] x86: Trenchboot secure dynamic launch Linux kernel support

2023-05-04 Thread Ross Philipson
The larger focus of the TrenchBoot project (https://github.com/TrenchBoot) is to enhance the boot security and integrity in a unified manner. The first area of focus has been on the Trusted Computing Group's Dynamic Launch for establishing a hardware Root of Trust for Measurement, also know as

[PATCH v6 12/14] x86: Secure Launch late initcall platform module

2023-05-04 Thread Ross Philipson
From: "Daniel P. Smith" The Secure Launch platform module is a late init module. During the init call, the TPM event log is read and measurements taken in the early boot stub code are located. These measurements are extended into the TPM PCRs using the mainline TPM kernel driver. The platform

[PATCH v6 14/14] x86: EFI stub DRTM launch support for Secure Launch

2023-05-04 Thread Ross Philipson
This support allows the DRTM launch to be initiated after and EFI stub launch of the Linux kernel is done. This is accomplished by providing a handler to jump to when a Secure Launch is in progress. Signed-off-by: Ross Philipson --- drivers/firmware/efi/libstub/x86-stub.c | 55

[PATCH v6 13/14] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch

2023-05-04 Thread Ross Philipson
The Secure Launch MLE environment uses PCRs that are only accessible from the DRTM locality 2. By default the TPM drivers always initialize the locality to 0. When a Secure Launch is in progress, initialize the locality to 2. Signed-off-by: Ross Philipson --- drivers/char/tpm/tpm-chip.c | 9

[PATCH v6 11/14] reboot: Secure Launch SEXIT support on reboot paths

2023-05-04 Thread Ross Philipson
If the MLE kernel is being powered off, rebooted or halted, then SEXIT must be called. Note that the SEXIT GETSEC leaf can only be called after a machine_shutdown() has been done on these paths. The machine_shutdown() is not called on a few paths like when poweroff action does not have a poweroff

[PATCH v6 10/14] kexec: Secure Launch kexec SEXIT support

2023-05-04 Thread Ross Philipson
Prior to running the next kernel via kexec, the Secure Launch code closes down private SMX resources and does an SEXIT. This allows the next kernel to start normally without any issues starting the APs etc. Signed-off-by: Ross Philipson --- arch/x86/kernel/slaunch.c | 69

[PATCH v6 09/14] x86: Secure Launch SMP bringup support

2023-05-04 Thread Ross Philipson
On Intel, the APs are left in a well documented state after TXT performs the late launch. Specifically they cannot have #INIT asserted on them so a standard startup via INIT/SIPI/SIPI cannot be performed. Instead the early SL stub code parked the APs in a pause/jmp loop waiting for an NMI. The

[PATCH v6 06/14] x86: Add early SHA support for Secure Launch early measurements

2023-05-04 Thread Ross Philipson
From: "Daniel P. Smith" The SHA algorithms are necessary to measure configuration information into the TPM as early as possible before using the values. This implementation uses the established approach of #including the SHA libraries directly in the code since the compressed kernel is not

[PATCH v6 04/14] x86: Secure Launch Resource Table header file

2023-05-04 Thread Ross Philipson
Introduce the Secure Launch Resource Table which forms the formal interface between the pre and post launch code. Signed-off-by: Ross Philipson --- include/linux/slr_table.h | 270 ++ 1 file changed, 270 insertions(+) create mode 100644

[PATCH v6 05/14] x86: Secure Launch main header file

2023-05-04 Thread Ross Philipson
Introduce the main Secure Launch header file used in the early SL stub and the early setup code. Signed-off-by: Ross Philipson --- include/linux/slaunch.h | 513 1 file changed, 513 insertions(+) create mode 100644 include/linux/slaunch.h diff

[PATCH v6 01/14] x86/boot: Place kernel_info at a fixed offset

2023-05-04 Thread Ross Philipson
From: Arvind Sankar There are use cases for storing the offset of a symbol in kernel_info. For example, the trenchboot series [0] needs to store the offset of the Measured Launch Environment header in kernel_info. Since commit (note: commit ID from tip/master) commit 527afc212231 ("x86/boot:

[PATCH v6 03/14] x86: Secure Launch Kconfig

2023-05-04 Thread Ross Philipson
Initial bits to bring in Secure Launch functionality. Add Kconfig options for compiling in/out the Secure Launch code. Signed-off-by: Ross Philipson --- arch/x86/Kconfig | 12 1 file changed, 12 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 53bab12..85ecf3f

Re: [PATCH v22 0/8] crash: Kernel handling of CPU and memory hot un/plug

2023-05-04 Thread Hari Bathini
On 04/05/23 4:11 am, Eric DeVolder wrote: Once the kdump service is loaded, if changes to CPUs or memory occur, either by hot un/plug or off/onlining, the crash elfcorehdr must also be updated. The elfcorehdr describes to kdump the CPUs and memory in the system, and any inaccuracies can

Re: [PATCH v2 0/6] crashdump: Kernel handling of CPU and memory hot un/plug

2023-05-04 Thread Hari Bathini
On 04/05/23 3:46 am, Eric DeVolder wrote: When the kdump service is loaded, if a CPU or memory is hot un/plugged, the crash elfcorehdr, which describes the CPUs and memory in the system, must also be updated, else the resulting vmcore is inaccurate (eg. missing either CPU context or memory