[PATCH 1/2] ima: Free IMA measurement buffer on error

2021-01-21 Thread Lakshmi Ramasubramanian
list in the error code paths in ima_add_kexec_buffer() function. Signed-off-by: Lakshmi Ramasubramanian Suggested-by: Tyler Hicks Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list") --- security/integrity/ima/ima_kexec.c | 2 ++ 1 file changed, 2 insertions(+)

[PATCH 2/2] ima: Free IMA measurement buffer after kexec syscall

2021-01-21 Thread Lakshmi Ramasubramanian
in "struct kimage" to store the virtual address of the buffer allocated for the IMA measurement list. Free the memory allocated for the IMA measurement list in kimage_file_post_load_cleanup() function. Signed-off-by: Lakshmi Ramasubramanian Suggested-by: Tyler Hicks Fixes: 7b8589cc29e7 (&qu

[PATCH v15 05/10] ima: Move arch_ima_add_kexec_buffer() to ima

2021-01-15 Thread Lakshmi Ramasubramanian
rpc. Move arch_ima_add_kexec_buffer() to ima. Co-developed-by: Prakhar Srivastava Signed-off-by: Prakhar Srivastava Signed-off-by: Lakshmi Ramasubramanian Acked-by: Mimi Zohar Reviewed-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/ima.h | 3 --- arch/powerpc/kexec/ima.c

[PATCH v15 06/10] powerpc: Move arch independent ima kexec functions to drivers/of/kexec.c

2021-01-15 Thread Lakshmi Ramasubramanian
t functions from "arch/powerpc/kexec/ima.c" to "drivers/of/kexec.c". Delete "arch/powerpc/kexec/ima.c" and "arch/powerpc/include/asm/ima.h". Remove references to the deleted files in powerpc and in ima. Co-developed-by: Prakhar Srivastava Signed-off-by: Prakhar

[PATCH v15 10/10] arm64: Add IMA log information in kimage used for kexec

2021-01-15 Thread Lakshmi Ramasubramanian
KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA is enabled, to indicate that the IMA measurement log information is present in the device tree for ARM64. Co-developed-by: Prakhar Srivastava Signed-off-by: Prakhar Srivastava Signed-off-by: Lakshmi Ramasubramanian Reviewed-by: T

[PATCH v15 08/10] powerpc: Delete unused function delete_fdt_mem_rsv()

2021-01-15 Thread Lakshmi Ramasubramanian
Prakhar Srivastava Signed-off-by: Lakshmi Ramasubramanian --- arch/powerpc/include/asm/kexec.h | 1 - arch/powerpc/kexec/file_load.c | 32 2 files changed, 33 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h in

[PATCH v15 07/10] kexec: Use fdt_appendprop_addrrange() to add ima buffer to FDT

2021-01-15 Thread Lakshmi Ramasubramanian
e next kernel across kexec system call. Remove custom code that is used in setup_ima_buffer() to add "linux,ima-kexec-buffer" property to the device tree. Co-developed-by: Prakhar Srivastava Signed-off-by: Prakhar Srivastava Signed-off-by: Lakshmi Ramasubramanian Reviewed-by: Thiag

[PATCH v15 09/10] arm64: Call kmalloc() to allocate DTB buffer

2021-01-15 Thread Lakshmi Ramasubramanian
. Co-developed-by: Prakhar Srivastava Signed-off-by: Prakhar Srivastava Signed-off-by: Lakshmi Ramasubramanian --- arch/arm64/kernel/machine_kexec_file.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel

[PATCH v15 04/10] powerpc: Use common of_kexec_setup_new_fdt()

2021-01-15 Thread Lakshmi Ramasubramanian
and update the memory reservation for kexec for powerpc. Signed-off-by: Rob Herring Reviewed-by: Thiago Jung Bauermann Reviewed-by: Lakshmi Ramasubramanian --- arch/powerpc/kexec/file_load.c | 125 ++--- 1 file changed, 6 insertions(+), 119 deletions(-) diff --git a/arch/pow

[PATCH v15 03/10] arm64: Use common of_kexec_setup_new_fdt()

2021-01-15 Thread Lakshmi Ramasubramanian
and update the memory reservation for kexec for arm64. Signed-off-by: Rob Herring Reviewed-by: Thiago Jung Bauermann Reviewed-by: Lakshmi Ramasubramanian Acked-by: Will Deacon --- arch/arm64/kernel/machine_kexec_file.c | 123 + 1 file changed, 3 insertions(+), 120 deletions(-)

[PATCH v15 01/10] powerpc: Rename kexec elfcorehdr_addr to elf_headers_mem

2021-01-15 Thread Lakshmi Ramasubramanian
for kexec system call. Rename elfcorehdr_addr to elf_headers_mem to align with arm64 name so common code can use it. Signed-off-by: Rob Herring Reviewed-by: Thiago Jung Bauermann Reviewed-by: Lakshmi Ramasubramanian --- arch/powerpc/include/asm/kexec.h | 2 +- arch/powerpc/kexec/file_load.c

[PATCH v15 02/10] of: Add a common kexec FDT setup function

2021-01-15 Thread Lakshmi Ramasubramanian
pc and arm64, in of_kexec_setup_new_fdt() and move it to "drivers/of/kexec.c". Signed-off-by: Rob Herring Reviewed-by: Thiago Jung Bauermann Reviewed-by: Lakshmi Ramasubramanian --- drivers/of/Makefile | 1 + drivers/of/kexec.c | 236

[PATCH v15 00/10] Carry forward IMA measurement log on kexec on ARM64

2021-01-15 Thread Lakshmi Ramasubramanian
he memory reserved by device tree for ima buffer pass. Add support for ima buffer pass using reserved memory for arm64 kexec. Update the arch sepcific code path in kexec file load to store the ima buffer in the reserved memory. The same reserved memory is read on kexec or cold boot.

Re: [PATCH] ima: add a new CONFIG for loading arch-specific policies

2020-02-26 Thread Lakshmi Ramasubramanian
Hi Nayna, + +config IMA_SECURE_AND_OR_TRUSTED_BOOT + bool + depends on IMA + depends on IMA_ARCH_POLICY + default n + help + This option is selected by architectures to enable secure and/or + trusted boot based on IMA runtime policies. Why is

Re: [PATCH v10 0/9] powerpc: Enabling IMA arch specific secure boot policies

2019-12-09 Thread Lakshmi Ramasubramanian
Hi Mimi, On 10/30/2019 8:31 PM, Mimi Zohar wrote: This patchset extends the previous version[1] by adding support for checking against a blacklist of binary hashes. The IMA subsystem supports custom, built-in, arch-specific policies to define the files to be measured and appraised. These

Re: [PATCH v9 0/4] powerpc: expose secure variables to the kernel and userspace

2019-11-11 Thread Lakshmi Ramasubramanian
On 11/10/19 7:10 PM, Nayna Jain wrote: Hi Nayna, In order to verify the OS kernel on PowerNV systems, secure boot requires X.509 certificates trusted by the platform. These are stored in secure variables controlled by OPAL, called OPAL secure variables. In order to enable users to manage the

Re: [PATCH v6 2/4] powerpc: expose secure variables to userspace via sysfs

2019-11-05 Thread Lakshmi Ramasubramanian
On 11/5/2019 12:24 AM, Eric Richter wrote: From: Nayna Jain PowerNV secure variables, which store the keys used for OS kernel verification, are managed by the firmware. These secure variables need to be accessed by the userspace for addition/deletion of the certificates. This patch adds the

Re: [PATCH v6 1/4] powerpc/powernv: Add OPAL API interface to access secure variable

2019-11-05 Thread Lakshmi Ramasubramanian
On 11/5/2019 12:24 AM, Eric Richter wrote: From: Nayna Jain The X.509 certificates trusted by the platform and required to secure boot the OS kernel are wrapped in secure variables, which are controlled by OPAL. This patch adds firmware/kernel interface to read and write OPAL secure

Re: [PATCH v10 5/9] ima: make process_buffer_measurement() generic

2019-10-31 Thread Lakshmi Ramasubramanian
On 10/31/19 10:02 AM, Lakshmi Ramasubramanian wrote: On 10/30/19 8:31 PM, Mimi Zohar wrote:   void ima_kexec_cmdline(const void *buf, int size)   { -    u32 secid; - -    if (buf && size != 0) { -    security_task_getsecid(current, ); +    if (buf && size != 0) Open br

Re: [PATCH v10 5/9] ima: make process_buffer_measurement() generic

2019-10-31 Thread Lakshmi Ramasubramanian
On 10/30/19 8:31 PM, Mimi Zohar wrote: void ima_kexec_cmdline(const void *buf, int size) { - u32 secid; - - if (buf && size != 0) { - security_task_getsecid(current, ); + if (buf && size != 0) Open brace { is missing in the above if statement.

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-30 Thread Lakshmi Ramasubramanian
On 10/23/19 8:47 PM, Nayna Jain wrote: Hi Nayna, process_buffer_measurement() is limited to measuring the kexec boot command line. This patch makes process_buffer_measurement() more generic, allowing it to measure other types of buffer data (e.g. blacklisted binary hashes or key hashes). Now

Re: [PATCH v9 2/8] powerpc/ima: add support to initialize ima policy rules

2019-10-25 Thread Lakshmi Ramasubramanian
On 10/25/2019 10:02 AM, Nayna Jain wrote: >> Is there any way to not use conditional compilation in >> the above array definition? Maybe define different functions to get >> "secure_rules" for when CONFIG_MODULE_SIG_FORCE is defined and when >> it is not defined. > > How will you decide which

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-25 Thread Lakshmi Ramasubramanian
On 10/25/2019 10:24 AM, Nayna Jain wrote: On 10/24/19 10:20 AM, Lakshmi Ramasubramanian wrote: On 10/23/19 8:47 PM, Nayna Jain wrote: Hi Nayna, +void process_buffer_measurement(const void *buf, int size, +    const char *eventname, enum ima_hooks func, +    int

Re: [PATCH v5 4/4] powerpc: load firmware trusted keys/hashes into kernel keyring

2019-10-25 Thread Lakshmi Ramasubramanian
On 10/24/19 5:58 PM, Nayna Jain wrote: + +/* + * Get a certificate list blob from the named secure variable. + */ +static __init void *get_cert_list(u8 *key, unsigned long keylen, uint64_t *size) +{ + int rc; + void *db; + + rc = secvar_ops->get(key, keylen, NULL, size); +

Re: [PATCH v5 2/4] powerpc: expose secure variables to userspace via sysfs

2019-10-25 Thread Lakshmi Ramasubramanian
On 10/24/19 5:47 PM, Nayna Jain wrote: +static ssize_t size_show(struct kobject *kobj, struct kobj_attribute *attr, +char *buf) +{ + uint64_t dsize; + int rc; + + rc = secvar_ops->get(kobj->name, strlen(kobj->name) + 1, NULL, ); + if (rc) { +

Re: [PATCH v5 1/4] powerpc/powernv: Add OPAL API interface to access secure variable

2019-10-25 Thread Lakshmi Ramasubramanian
On 10/24/19 5:47 PM, Nayna Jain wrote: diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 378e3997845a..c1f25a760eb1 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -211,7 +211,10 @@ #define

Re: [PATCH v9 7/8] ima: check against blacklisted hashes for files with modsig

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * ima_check_blacklist - determine if the binary is blacklisted. + * + * Add the hash of the blacklisted binary to the measurement list, based + * on policy. + * + * Returns -EPERM if the hash is blacklisted. + */ +int ima_check_blacklist(struct

Re: [PATCH v9 4/8] powerpc/ima: define trusted boot policy

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * The "secure_and_trusted_rules" contains rules for both the secure boot and + * trusted boot. The "template=ima-modsig" option includes the appended + * signature, when available, in the IMA measurement list. + */ +static const char *const

Re: [PATCH v9 3/8] powerpc: detect the trusted boot state of the system

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +bool is_ppc_trustedboot_enabled(void) +{ + struct device_node *node; + bool enabled = false; + + node = get_ppc_fw_sb_node(); + enabled = of_property_read_bool(node, "trusted-enabled"); Can get_ppc_fw_sb_node return NULL? Would

Re: [PATCH v9 2/8] powerpc/ima: add support to initialize ima policy rules

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: +/* + * The "secure_rules" are enabled only on "secureboot" enabled systems. + * These rules verify the file signatures against known good values. + * The "appraise_type=imasig|modsig" option allows the known good signature + * to be stored as an xattr

Re: [PATCH v9 1/8] powerpc: detect the secure boot mode of the system

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/2019 8:47 PM, Nayna Jain wrote: This patch defines a function to detect the secure boot state of a PowerNV system. +bool is_ppc_secureboot_enabled(void) +{ + struct device_node *node; + bool enabled = false; + + node = of_find_compatible_node(NULL, NULL,

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-24 Thread Lakshmi Ramasubramanian
On 10/23/19 8:47 PM, Nayna Jain wrote: Hi Nayna, +void process_buffer_measurement(const void *buf, int size, + const char *eventname, enum ima_hooks func, + int pcr) { int ret = 0; struct ima_template_entry *entry =

<    1   2