Re: [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
On 2/3/2025 10:42 AM, steven chen 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'. New events can be measured during/after

[PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
aint, rather than just bailing out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully or partially from the current Kernel to the next. - Refactored patches to ensure no warnings during individual patch compilation. - Used virt_to

[PATCH v7 2/7] kexec: define functions to map and unmap segments

2025-02-03 Thread steven chen
: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 7 ++ kernel/kexec_core.c | 54 +++ 2 files changed, 61 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3.

[PATCH v7 7/7] ima: measure kexec load and exec events as critical data

2025-02-03 Thread steven chen
sence of 'kexec_execute' event after kexec soft reboot implies missing events in that window which results in inconsistency with TPM PCR quotes, necessitating a cold boot for a successful remote attestation. Reviewed-by: Stefan Berger Author: Tushar Sugandhi Signed-off-by:

[PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-03 Thread steven chen
hor: Tushar Sugandhi Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 3 +++ kernel/kexec_file.c| 23 +++ security/integrity/ima/ima_kexec.c | 3 +++ 3 files changed, 29 insertions(+) diff --git a/include/lin

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 6/7] ima: make the kexec extra memory configurable

2025-02-03 Thread steven chen
: Tushar Sugandhi Author: Tushar Sugandhi Suggested-by: Stefan Berger Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/Kconfig | 10 ++ security/integrity/ima/ima_kexec.c | 16 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf

2025-02-03 Thread steven chen
situation will result in a failure of remote attestation. Author: Tushar Sugandhi Reviewed-by: Stefan Berger Suggested-by: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_kexec.c | 105 +

Re: [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
On 2/3/2025 4:50 PM, Mimi Zohar wrote: On Mon, 2025-02-03 at 15:25 -0800, steven chen wrote: Hi all, The below is the correct version for review. [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute < https://lore.kernel.org/linux-integrity/20250203232033.64123-1-chen

[PATCH v7 5/7] ima: kexec: move IMA log copy from kexec load to execute

2025-02-03 Thread steven chen
buffer(). - Remove ima_reset_kexec_file() call from ima_add_kexec_buffer(), now that the buffer is being copied at kexec 'execute', and resetting the file at kexec 'load' will corrupt the buffer. Author: Tushar Sugandhi Reviewed-by: Tyler Hicks Signed-off-by: Tushar Su

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 2/7] kexec: define functions to map and unmap segments

2025-02-03 Thread steven chen
: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 7 ++ kernel/kexec_core.c | 54 +++ 2 files changed, 61 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3.

[PATCH v7 6/7] ima: make the kexec extra memory configurable

2025-02-03 Thread steven chen
: Tushar Sugandhi Author: Tushar Sugandhi Suggested-by: Stefan Berger Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/Kconfig | 10 ++ security/integrity/ima/ima_kexec.c | 16 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff

[PATCH v7 7/7] ima: measure kexec load and exec events as critical data

2025-02-03 Thread steven chen
sence of 'kexec_execute' event after kexec soft reboot implies missing events in that window which results in inconsistency with TPM PCR quotes, necessitating a cold boot for a successful remote attestation. Reviewed-by: Stefan Berger Author: Tushar Sugandhi Signed-off-by:

[PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
aint, rather than just bailing out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully or partially from the current Kernel to the next. - Refactored patches to ensure no warnings during individual patch compilation. - Used virt_to

[PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-03 Thread steven chen
hor: Tushar Sugandhi Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 3 +++ kernel/kexec_file.c| 23 +++ security/integrity/ima/ima_kexec.c | 3 +++ 3 files changed, 29 insertions(+) diff --git a/include/lin

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf

2025-02-03 Thread steven chen
situation will result in a failure of remote attestation. Author: Tushar Sugandhi Reviewed-by: Stefan Berger Suggested-by: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_kexec.c | 105 +

Re: [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
On 2/3/2025 10:45 AM, steven chen 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'. New events can be measured during/after

[PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf

2025-02-03 Thread steven chen
situation will result in a failure of remote attestation. Author: Tushar Sugandhi Reviewed-by: Stefan Berger Suggested-by: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_kexec.c | 105 +

[PATCH v7 0/7] ima: kexec: measure events between kexec load and excute

2025-02-03 Thread steven chen
aint, rather than just bailing out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully or partially from the current Kernel to the next. - Refactored patches to ensure no warnings during individual patch compilation. - Used virt_to

[PATCH v7 2/7] kexec: define functions to map and unmap segments

2025-02-03 Thread steven chen
: Mimi Zohar Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 7 ++ kernel/kexec_core.c | 54 +++ 2 files changed, 61 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index f0e9f8eda7a3.

[PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-03 Thread steven chen
hor: Tushar Sugandhi Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/kexec.h | 3 +++ kernel/kexec_file.c| 23 +++ security/integrity/ima/ima_kexec.c | 3 +++ 3 files changed, 29 insertions(+) diff --git a/include/lin

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 7/7] ima: measure kexec load and exec events as critical data

2025-02-03 Thread steven chen
sence of 'kexec_execute' event after kexec soft reboot implies missing events in that window which results in inconsistency with TPM PCR quotes, necessitating a cold boot for a successful remote attestation. Reviewed-by: Stefan Berger Author: Tushar Sugandhi Signed-off-by:

[PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-03 Thread steven chen
ger Suggested-by: Mimi Zohar Reviewed-by: "Petr Tesařík" Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 46 ++ 2 files changed, 49 insertions(+) diff --git a/i

[PATCH v7 6/7] ima: make the kexec extra memory configurable

2025-02-03 Thread steven chen
: Tushar Sugandhi Author: Tushar Sugandhi Suggested-by: Stefan Berger Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- security/integrity/ima/Kconfig | 10 ++ security/integrity/ima/ima_kexec.c | 16 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff

Re: [PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-04 Thread steven chen
On 2/4/2025 11:39 AM, Stefan Berger wrote: On 2/3/25 6:20 PM, steven chen wrote: kexec_calculate_store_digests() calculates and stores the digest of the segment at kexec_file_load syscall where the IMA segment is also allocated.  With this series, the IMA segment will be updated with the

Re: [PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf

2025-02-07 Thread steven chen
know that I've started reviewing the patch set. The remaining comments will come after I finish reviewing the patch set. On Mon, 2025-02-03 at 15:20 -0800, steven chen wrote: Carrying the IMA measurement list across kexec requires allocating a buffer and copying the measurement records.  Sep

Re: [PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf

2025-02-07 Thread steven chen
On 2/7/2025 11:10 AM, Mimi Zohar wrote: On Mon, 2025-02-03 at 15:20 -0800, steven chen wrote: Carrying the IMA measurement list across kexec requires allocating a buffer and copying the measurement records.  Separate allocating the buffer and copying the measurement records into separate

Re: [PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-07 Thread steven chen
On 2/4/2025 11:39 AM, Stefan Berger wrote: On 2/3/25 6:20 PM, steven chen wrote: kexec_calculate_store_digests() calculates and stores the digest of the segment at kexec_file_load syscall where the IMA segment is also allocated.  With this series, the IMA segment will be updated with the

Re: [PATCH v7 7/7] ima: measure kexec load and exec events as critical data

2025-02-07 Thread steven chen
On 2/7/2025 9:48 AM, Stefan Berger wrote: On 2/7/25 12:06 PM, Mimi Zohar wrote: On Fri, 2025-02-07 at 10:16 -0500, Mimi Zohar wrote: On Mon, 2025-02-03 at 15:20 -0800, steven chen wrote: The amount of memory allocated at kexec load, even with the extra memory allocated, might not be large

Re: [PATCH v7 2/7] kexec: define functions to map and unmap segments

2025-02-10 Thread steven chen
On 2/7/2025 11:15 AM, Mimi Zohar wrote: Hi Steven, On Mon, 2025-02-03 at 15:20 -0800, steven chen wrote: Currently, the mechanism to map and unmap segments to the kimage structure is not available to the subsystems outside of kexec.  This functionality is needed when IMA is allocating the

Re: [PATCH v10 6/8] ima: kexec: move IMA log copy from kexec load to execute

2025-03-21 Thread steven chen
On 3/19/2025 1:53 PM, Mimi Zohar wrote: On Mon, 2025-03-17 at 18:04 -0700, steven chen wrote: ima_dump_measurement_list() is called during kexec 'load', which may result in loss of IMA measurements during kexec soft reboot. Due to missed measurements that only occurred after kexec &#

Re: [PATCH v10 7/8] ima: make the kexec extra memory configurable

2025-03-21 Thread steven chen
On 3/19/2025 7:52 PM, Baoquan He wrote: On 03/17/25 at 06:04pm, steven chen wrote: The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to configure the extra

Re: [PATCH v10 6/8] ima: kexec: move IMA log copy from kexec load to execute

2025-03-21 Thread steven chen
On 3/19/2025 7:06 PM, Baoquan He wrote: On 03/17/25 at 06:04pm, steven chen wrote: ...snip... --- kernel/kexec_file.c| 10 ++ security/integrity/ima/ima_kexec.c | 51 ++ 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/kernel

Re: [PATCH v10 1/8] ima: rename variable the ser_file "file" to "ima_kexec_file"

2025-03-21 Thread steven chen
On 3/19/2025 6:42 AM, Mimi Zohar wrote: Fix spelling: set_file On Mon, 2025-03-17 at 18:04 -0700, steven chen wrote: The name of the local variable "file" of type seq_file defined in the ima_dump_measurement_list function is too generic. To better reflect the purpose of the variab

Re: [PATCH v10 1/8] ima: rename variable the ser_file "file" to "ima_kexec_file"

2025-03-21 Thread steven chen
On 3/18/2025 7:43 PM, Baoquan He wrote: On 03/18/25 at 11:10am, Stefan Berger wrote: On 3/17/25 9:04 PM, steven chen wrote: The name of the local variable "file" of type seq_file defined in the ima_dump_measurement_list function is too generic. To better reflect the purpose of th

Re: [PATCH v10 2/8] ima: define and call ima_alloc_kexec_file_buf()

2025-03-21 Thread steven chen
On 3/20/2025 6:06 AM, Mimi Zohar wrote: On Thu, 2025-03-20 at 09:51 +0800, Baoquan He wrote: diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c index 8567619889d1..45170e283272 100644 --- a/security/integrity/ima/ima_kexec.c +++ b/security/integrity/ima/ima_kex

Re: [PATCH v10 8/8] ima: measure kexec load and exec events as critical data

2025-03-21 Thread steven chen
On 3/19/2025 7:59 PM, Mimi Zohar wrote: On Mon, 2025-03-17 at 18:04 -0700, steven chen wrote: The amount of memory allocated at kexec load, even with the extra memory allocated, might not be large enough for the entire measurement list. The indeterminate interval between kexec 'load

[PATCH v10 7/8] ima: make the kexec extra memory configurable

2025-03-17 Thread steven chen
-by: Stefan Berger Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen Reviewed-by: Stefan Berger Reviewed-by: Mimi Zohar --- security/integrity/ima/Kconfig | 10 ++ security/integrity/ima/ima_kexec.c | 16 +++- 2 files changed, 21 insertions(+), 5 deletions

[PATCH v10 0/8] ima: kexec: measure events between kexec load and execute

2025-03-17 Thread steven chen
y in case of kexec soft reboot, and not on kexec crash. - Updated the logic to copy as many IMA events as possible in case of memory constraint, rather than just bailing out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully

[PATCH v10 2/8] ima: define and call ima_alloc_kexec_file_buf()

2025-03-17 Thread steven chen
ake the local variable ima_kexec_file in ima_dump_measurement_list() a local static to the file, so that it can be accessed from ima_alloc_kexec_file_buf(). - Make necessary changes to the function ima_add_kexec_buffer() to call the above two functions. Signed-off-by: Tushar Sugandhi Signed-off-by:

[PATCH v10 4/8] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-03-17 Thread steven chen
ha_regions', no change is needed in verify_sha256_digest() in this context. With this change, the IMA segment is not included in the digest calculation, storage, and verification. Signed-off-by: Tushar Sugandhi Cc: Eric Biederman Cc: Baoquan He Cc: Vivek Goyal Cc: Dave Young Signed-

[PATCH v10 1/8] ima: rename variable the ser_file "file" to "ima_kexec_file"

2025-03-17 Thread steven chen
memory, it copies all IMA measurement records; otherwise, it does not copy any records, which would result in a failure of remote attestation. Suggested-by: Mimi Zohar Signed-off-by: steven chen --- security/integrity/ima/ima_kexec.c | 39 ++ 1 file changed, 24 insertions(

[PATCH v10 3/8] kexec: define functions to map and unmap segments

2025-03-17 Thread steven chen
us virtual address range. The function returns the start virtual address of this range if successful, or NULL on failure. Implement kimage_unmap_segment() for unmapping segments using vunmap(). From: Tushar Sugandhi Signed-off-by: Tushar Sugandhi Cc: Eric Biederman Cc: Baoquan He Cc: Vivek

[PATCH v10 6/8] ima: kexec: move IMA log copy from kexec load to execute

2025-03-17 Thread steven chen
setting the file at kexec 'load' would corrupt the buffer. Signed-off-by: Tushar Sugandhi Cc: Eric Biederman Cc: Baoquan He Cc: Vivek Goyal Cc: Dave Young Signed-off-by: steven chen Reviewed-by: Stefan Berger --- kernel/kexec_file.c| 10 ++ security/integrity/im

[PATCH v10 5/8] ima: kexec: define functions to copy IMA log at soft boot

2025-03-17 Thread steven chen
'. Signed-off-by: Tushar Sugandhi Cc: Eric Biederman Cc: Baoquan He Cc: Vivek Goyal Cc: Dave Young Signed-off-by: steven chen Reviewed-by: Stefan Berger Signed-off-by: steven chen --- include/linux/ima.h| 3 ++ security/integrity/ima/ima_kexec.c | 47 +

[PATCH v10 8/8] ima: measure kexec load and exec events as critical data

2025-03-17 Thread steven chen
xxd -r -p | sha256sum To verify the 'kexec_execute' data hash: sudo cat /sys/kernel/security/integrity/ima/ascii_runtime_measurements | grep kexec_execute | cut -d' ' -f 6 | xxd -r -p | sha256sum Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen Reviewed-by: Stefan Be

[PATCH v11 0/9] ima: kexec: measure events between kexec load and execute

2025-04-05 Thread steven chen
ng out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully or partially from the current Kernel to the next. - Refactored patches to ensure no warnings during individual patch compilation. - Used virt_to_page instead of phys

[PATCH v11 7/9] ima: verify if the segment size has changed

2025-04-05 Thread steven chen
kexec 'load' may be called multiple times. Free and realloc the buffer only if the segment_size is changed from the previous kexec 'load' call. Signed-off-by: steven chen --- security/integrity/ima/ima_kexec.c | 10 ++ 1 file changed, 10 insertions(+) diff --git

Re: [PATCH v10 6/8] ima: kexec: move IMA log copy from kexec load to execute

2025-03-25 Thread steven chen
On 3/24/2025 4:00 AM, Baoquan He wrote: On 03/21/25 at 09:23am, steven chen wrote: On 3/19/2025 7:06 PM, Baoquan He wrote: On 03/17/25 at 06:04pm, steven chen wrote: ...snip... --- kernel/kexec_file.c| 10 ++ security/integrity/ima/ima_kexec.c | 51

Re: [PATCH v10 6/8] ima: kexec: move IMA log copy from kexec load to execute

2025-03-26 Thread steven chen
On 3/25/2025 7:27 PM, Baoquan He wrote: On 03/25/25 at 03:27pm, steven chen wrote: On 3/24/2025 4:00 AM, Baoquan He wrote: On 03/21/25 at 09:23am, steven chen wrote: On 3/19/2025 7:06 PM, Baoquan He wrote: On 03/17/25 at 06:04pm, steven chen wrote: ...snip... --- kernel/kexec_file.c

Re: [PATCH v11 3/9] kexec: define functions to map and unmap segments

2025-04-10 Thread steven chen
On 4/7/2025 8:10 PM, Baoquan He wrote: On 04/02/25 at 05:47am, steven chen wrote: Currently, the kernel behavior during kexec load is to fetch the IMA measurements logs and store logs in kernel memory. When a kexec reboot is triggered, these stored logs in the kernel memory are carried over to

Re: [PATCH v11 5/9] ima: kexec: define functions to copy IMA log at soft boot

2025-04-10 Thread steven chen
On 4/8/2025 7:21 AM, Mimi Zohar wrote: On Wed, 2025-04-02 at 05:47 -0700, steven chen wrote: The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the log copied at kexec 'load' may result in loss of IMA measurement

Re: [PATCH v11 6/9] ima: kexec: move IMA log copy from kexec load to execute

2025-04-10 Thread steven chen
On 4/8/2025 9:17 AM, Mimi Zohar wrote: On Wed, 2025-04-02 at 05:47 -0700, steven chen wrote: ima_dump_measurement_list() is called during kexec 'load', which may result in loss of IMA measurements during kexec soft reboot. Due to missed measurements that only occurred after kexec &#

Re: [PATCH v11 4/9] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-04-10 Thread steven chen
On 4/7/2025 8:17 PM, Baoquan He wrote: On 04/02/25 at 05:47am, steven chen wrote: The kexec_calculate_store_digests() function calculates and stores the digest of the segment during the kexec_file_load syscall, where the IMA segment is also allocated. With this series, the IMA segment will be

Re: [PATCH v11 8/9] ima: make the kexec extra memory configurable

2025-04-10 Thread steven chen
On 4/10/2025 2:54 AM, Baoquan He wrote: On 04/02/25 at 05:47am, steven chen wrote: The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to configure the extra

Re: [PATCH v11 8/9] ima: make the kexec extra memory configurable

2025-04-10 Thread steven chen
On 4/10/2025 11:04 AM, Mimi Zohar wrote: On Thu, 2025-04-10 at 09:59 -0700, steven chen wrote: On 4/10/2025 2:54 AM, Baoquan He wrote: On 04/02/25 at 05:47am, steven chen wrote: The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make

Re: [PATCH v9 2/7] kexec: define functions to map and unmap segments

2025-03-17 Thread steven chen
On 3/5/2025 4:24 AM, Baoquan He wrote: On 03/04/25 at 04:55pm, steven chen wrote: On 3/4/2025 2:23 PM, Jarkko Sakkinen wrote: On Tue, Mar 04, 2025 at 11:03:46AM -0800, steven chen wrote: The content of memory segments carried over to the new kernel during the kexec systemcall can be changed

Re: [PATCH v12 0/9] ima: kexec: measure events between kexec load and execute

2025-04-20 Thread steven chen
On 4/16/2025 6:09 PM, Stefan Berger wrote: On 4/15/25 10:10 PM, steven chen wrote: From: Steven Chen 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

Re: [PATCH v12 2/9] ima: define and call ima_alloc_kexec_file_buf()

2025-04-20 Thread steven chen
On 4/17/2025 9:33 PM, Baoquan He wrote: Hi Steven, On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen In the current implementation, the ima_dump_measurement_list() API is called during the kexec "load" phase, where a buffer is allocated and the measurement records are c

Re: [PATCH v12 3/9] kexec: define functions to map and unmap segments

2025-04-20 Thread steven chen
On 4/17/2025 9:36 PM, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen ^^ Implement kimage_map_segment() to enable IMA to map the measurement log list to the kimage structure during the kexec 'load' stage. This function gathers the source pages

Re: [PATCH v12 4/9] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-04-20 Thread steven chen
On 4/18/2025 12:37 AM, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen Currently, the function kexec_calculate_store_digests() calculates and stores the digest of the segment during the kexec_file_load syscall, where the IMA segment is also allocated. Later

Re: [PATCH v12 5/9] ima: kexec: define functions to copy IMA log at soft boot

2025-04-20 Thread steven chen
On 4/18/2025 12:40 AM, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the log copied at kexec 'load' may result in loss of I

Re: [PATCH v12 8/9] ima: make the kexec extra memory configurable

2025-04-20 Thread steven chen
On 4/18/2025 1:14 AM, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to

Re: [PATCH v12 9/9] ima: measure kexec load and exec events as critical data

2025-04-20 Thread steven chen
On 4/18/2025 2:08 AM, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen The amount of memory allocated at kexec load, even with the extra memory allocated, might not be large enough for the entire measurement list. The indeterminate interval between kexec '

Re: [PATCH v13 3/9] kexec: define functions to map and unmap segments

2025-04-23 Thread steven chen
On 4/22/2025 5:29 PM, Mimi Zohar wrote: On Mon, 2025-04-21 at 15:25 -0700, steven chen wrote: From: Steven Chen Implement kimage_map_segment() to enable IMA to map the measurement log list to the kimage structure during the kexec 'load' stage. This function gathers the source pages

Re: [PATCH v13 8/9] ima: make the kexec extra memory configurable

2025-04-29 Thread steven chen
On 4/29/2025 12:06 PM, Stefan Berger wrote: On 4/21/25 6:25 PM, steven chen wrote: From: Steven Chen The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE.  Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to

[PATCH] ima: Kdump kernel doesn't need IMA to do integrity measurement

2025-05-02 Thread steven chen
From: Steven Chen Kdump kernel doesn't need IMA to do integrity measurement. Hence the measurement list in 1st kernel doesn't need to be copied to kdump kenrel. Here skip allocating buffer for measurement list copying if loading kdump kernel. Then there won't be the later hand

Re: [PATCH v13 0/9] ima: kexec: measure events between kexec load and execute

2025-04-24 Thread steven chen
On 4/24/2025 7:37 AM, Baoquan He wrote: Hi Steven, Could you test below code and post a formal patch to not copy measurement list buffer to kdump kernel? Below log is just for your reference, please feel free to modify or rephrase. === Kdump kernel doesn't need IMA to do integrity measurement.

[PATCH v12 1/9] ima: rename variable the seq_file "file" to "ima_kexec_file"

2025-04-15 Thread steven chen
From: Steven Chen Before making the function local seq_file "file" variable file static global, rename it to "ima_kexec_file". Signed-off-by: Steven Chen --- security/integrity/ima/ima_kexec.c | 31 +++--- 1 file changed, 16 insertions(+), 15 deleti

[PATCH v12 0/9] ima: kexec: measure events between kexec load and execute

2025-04-15 Thread steven chen
From: Steven Chen 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'. Currently, the kernel behavior during kexec load is to fetch the

[PATCH v12 5/9] ima: kexec: define functions to copy IMA log at soft boot

2025-04-15 Thread steven chen
From: Steven Chen The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the log copied at kexec 'load' may result in loss of IMA measurements that only occurred after kexec "load'. Setup the needed infr

[PATCH v12 4/9] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-04-15 Thread steven chen
From: Steven Chen Currently, the function kexec_calculate_store_digests() calculates and stores the digest of the segment during the kexec_file_load syscall, where the IMA segment is also allocated. Later, the IMA segment will be updated with the measurement log at the kexec execute stage when

[PATCH v12 3/9] kexec: define functions to map and unmap segments

2025-04-15 Thread steven chen
From: Steven Chen Implement kimage_map_segment() to enable IMA to map the measurement log list to the kimage structure during the kexec 'load' stage. This function gathers the source pages within the specified address range, and maps them to a contiguous virtual address range.

[PATCH v12 2/9] ima: define and call ima_alloc_kexec_file_buf()

2025-04-15 Thread steven chen
From: Steven Chen In the current implementation, the ima_dump_measurement_list() API is called during the kexec "load" phase, where a buffer is allocated and the measurement records are copied. Due to this, new events added after kexec load but before kexec execute are not carried o

[PATCH v12 9/9] ima: measure kexec load and exec events as critical data

2025-04-15 Thread steven chen
From: Steven Chen The amount of memory allocated at kexec load, even with the extra memory allocated, might not be large enough for the entire measurement list. The indeterminate interval between kexec 'load' and 'execute' could exacerbate this problem. Define two new IMA

[PATCH v12 6/9] ima: kexec: move IMA log copy from kexec load to execute

2025-04-15 Thread steven chen
From: Steven Chen The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the IMA measurement list copied at kexec 'load' may result in loss of IMA measurements records that only occurred after the kexec 'load&#

[PATCH v12 8/9] ima: make the kexec extra memory configurable

2025-04-15 Thread steven chen
From: Steven Chen The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to configure the extra memory (in kb) to be allocated for IMA measurements added during kexec

[PATCH v12 7/9] ima: verify if the segment size has changed

2025-04-15 Thread steven chen
From: Steven Chen kexec 'load' may be called multiple times. Free and realloc the buffer only if the segment_size is changed from the previous kexec 'load' call. Signed-off-by: Steven Chen Acked-by: Baoquan He Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_kexec.

Re: [PATCH v13 0/9] ima: kexec: measure events between kexec load and execute

2025-05-02 Thread steven chen
On 4/24/2025 7:37 AM, Baoquan He wrote: Hi Steven, Could you test below code and post a formal patch to not copy measurement list buffer to kdump kernel? Below log is just for your reference, please feel free to modify or rephrase. === Kdump kernel doesn't need IMA to do integrity measurement.

Re: [PATCH v12 3/9] kexec: define functions to map and unmap segments

2025-04-21 Thread steven chen
On 4/21/2025 7:18 AM, Mimi Zohar wrote: On Mon, 2025-04-21 at 09:51 -0400, Mimi Zohar wrote: On Fri, 2025-04-18 at 12:36 +0800, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From: Steven Chen ^^ As James Bottomley previously explained[1], if you haven't mad

Re: [PATCH v12 3/9] kexec: define functions to map and unmap segments

2025-04-21 Thread steven chen
On 4/21/2025 2:35 PM, Mimi Zohar wrote: On Mon, 2025-04-21 at 13:40 -0700, steven chen wrote: On 4/21/2025 7:18 AM, Mimi Zohar wrote: On Mon, 2025-04-21 at 09:51 -0400, Mimi Zohar wrote: On Fri, 2025-04-18 at 12:36 +0800, Baoquan He wrote: On 04/15/25 at 07:10pm, steven chen wrote: From

[PATCH v13 0/9] ima: kexec: measure events between kexec load and execute

2025-04-21 Thread steven chen
From: Steven Chen 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'. Currently, the kernel behavior during kexec load is to fetch the

[PATCH v13 2/9] ima: define and call ima_alloc_kexec_file_buf()

2025-04-21 Thread steven chen
From: Steven Chen In the current implementation, the ima_dump_measurement_list() API is called during the kexec "load" phase, where a buffer is allocated and the measurement records are copied. Due to this, new events added after kexec load but before kexec execute are not carried o

[PATCH v13 1/9] ima: rename variable the seq_file "file" to "ima_kexec_file"

2025-04-21 Thread steven chen
From: Steven Chen Before making the function local seq_file "file" variable file static global, rename it to "ima_kexec_file". Signed-off-by: Steven Chen Acked-by: Baoquan He --- security/integrity/ima/ima_kexec.c | 31 +++--- 1 file changed,

[PATCH v13 9/9] ima: measure kexec load and exec events as critical data

2025-04-21 Thread steven chen
From: Steven Chen The amount of memory allocated at kexec load, even with the extra memory allocated, might not be large enough for the entire measurement list. The indeterminate interval between kexec 'load' and 'execute' could exacerbate this problem. Define two new IMA

[PATCH v13 8/9] ima: make the kexec extra memory configurable

2025-04-21 Thread steven chen
From: Steven Chen The extra memory allocated for carrying the IMA measurement list across kexec is hard-coded as half a PAGE. Make it configurable. Define a Kconfig option, IMA_KEXEC_EXTRA_MEMORY_KB, to configure the extra memory (in kb) to be allocated for IMA measurements added during kexec

[PATCH v13 5/9] ima: kexec: define functions to copy IMA log at soft boot

2025-04-21 Thread steven chen
From: Steven Chen The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the log copied at kexec 'load' may result in loss of IMA measurements that only occurred after kexec "load'. Setup the needed infr

[PATCH v13 6/9] ima: kexec: move IMA log copy from kexec load to execute

2025-04-21 Thread steven chen
From: Steven Chen The IMA log is currently copied to the new kernel during kexec 'load' using ima_dump_measurement_list(). However, the IMA measurement list copied at kexec 'load' may result in loss of IMA measurements records that only occurred after the kexec 'load&#

[PATCH v13 7/9] ima: verify if the segment size has changed

2025-04-21 Thread steven chen
From: Steven Chen kexec 'load' may be called multiple times. Free and realloc the buffer only if the segment_size is changed from the previous kexec 'load' call. Signed-off-by: Steven Chen Acked-by: Baoquan He Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_kexec.

[PATCH v13 4/9] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-04-21 Thread steven chen
From: Steven Chen Currently, the function kexec_calculate_store_digests() calculates and stores the digest of the segment during the kexec_file_load syscall, where the IMA segment is also allocated. Later, the IMA segment will be updated with the measurement log at the kexec execute stage when

[PATCH v13 3/9] kexec: define functions to map and unmap segments

2025-04-21 Thread steven chen
From: Steven Chen Implement kimage_map_segment() to enable IMA to map the measurement log list to the kimage structure during the kexec 'load' stage. This function gathers the source pages within the specified address range, and maps them to a contiguous virtual address range.

[PATCH v8 5/7] ima: kexec: move IMA log copy from kexec load to execute

2025-02-18 Thread steven chen
buffer(). - Remove ima_reset_kexec_file() call from ima_add_kexec_buffer(), now that the buffer is being copied at kexec 'execute', and resetting the file at kexec 'load' will corrupt the buffer. Signed-off-by: Tushar Sugandhi Signed-off-by: steven chen --- kernel/kex

[PATCH v8 4/7] ima: kexec: define functions to copy IMA log at soft boot

2025-02-18 Thread steven chen
nvoked after the new Kernel image has been loaded for kexec. ima_kexec_post_load() maps the IMA buffer to a segment in the newly loaded Kernel. It also registers the reboot notifier_block to trigger ima_update_kexec_buffer() at exec 'execute'. Signed-off-by: Tushar Sugandhi Signed-off-by:

[PATCH v8 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot

2025-02-18 Thread steven chen
igned-off-by: Tushar Sugandhi Signed-off-by: steven chen Reviewed-by: Stefan Berger --- include/linux/kexec.h | 3 +++ kernel/kexec_file.c| 22 ++ security/integrity/ima/ima_kexec.c | 3 +++ 3 files changed, 28 insertions(+) diff --git a/include/lin

[PATCH v8 2/7] kexec: define functions to map and unmap segments

2025-02-18 Thread steven chen
, and map these to a contiguous virtual address range. The function returns the start of this range if successful, or NULL if unsuccessful. Implement kimage_unmap_segment() for unmapping segments using vunmap(). From: Tushar Sugandhi Author: Tushar Sugandhi Signed-off-by: Tushar Sugandhi Signed

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

2025-02-18 Thread steven chen
of kexec soft reboot, and not on kexec crash. - Updated the logic to copy as many IMA events as possible in case of memory constraint, rather than just bailing out. - Introduced two new events to be measured by IMA during kexec, to help diagnose if the IMA log was copied fully or partial

  1   2   >