From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sB6RS4qHkzDqTs for ; Sat, 13 Aug 2016 13:19:00 +1000 (AEST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7D3Ir0p118707 for ; Fri, 12 Aug 2016 23:18:58 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 24scb95198-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 12 Aug 2016 23:18:58 -0400 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 13 Aug 2016 00:18:55 -0300 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id BE04B352005F for ; Fri, 12 Aug 2016 23:18:31 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7D3Iq7K4960378 for ; Sat, 13 Aug 2016 00:18:52 -0300 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7D3Ioe3013768 for ; Sat, 13 Aug 2016 00:18:52 -0300 From: Thiago Jung Bauermann To: kexec@lists.infradead.org Cc: linux-security-module@vger.kernel.org, linux-ima-devel@lists.sourceforge.net, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, x86@kernel.org, Eric Biederman , Dave Young , Vivek Goyal , Baoquan He , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Stewart Smith , Samuel Mendoza-Jonas , Mimi Zohar , Eric Richter , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrew Morton , Petko Manolov , David Laight , Balbir Singh , Thiago Jung Bauermann Subject: [PATCH v2 0/6] kexec_file: Add buffer hand-over for the next kernel Date: Sat, 13 Aug 2016 00:18:19 -0300 Message-Id: <1471058305-30198-1-git-send-email-bauerman@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hello, This patch series implements a mechanism which allows the kernel to pass on a buffer to the kernel that will be kexec'd. This buffer is passed as a segment which is added to the kimage when it is being prepared by kexec_file_load. How the second kernel is informed of this buffer is architecture-specific. On powerpc, this is done via the device tree, by checking the properties /chosen/linux,kexec-handover-buffer-start and /chosen/linux,kexec-handover-buffer-end, which is analogous to how the kernel finds the initrd. This is needed because the Integrity Measurement Architecture subsystem needs to preserve its measurement list accross the kexec reboot. The following patch series for the IMA subsystem uses this feature for that purpose: https://lists.infradead.org/pipermail/kexec/2016-August/016745.html This is so that IMA can implement trusted boot support on the OpenPower platform, because on such systems an intermediary Linux instance running as part of the firmware is used to boot the target operating system via kexec. Using this mechanism, IMA on this intermediary instance can hand over to the target OS the measurements of the components that were used to boot it. Because there could be additional measurement events between the kexec_file_load call and the actual reboot, IMA needs a way to update the buffer with those additional events before rebooting. One can minimize the interval between the kexec_file_load and the reboot syscalls, but as small as it can be, there is always the possibility that the measurement list will be out of date at the time of reboot. To address this issue, this patch series also introduces kexec_update_segment, which allows a reboot notifier to change the contents of the image segment during the reboot process. Patch 5 makes kimage_load_normal_segment and kexec_update_segment share code. It's not much code that they can share though, so I'm not sure if the result is actually better. The last patch is not intended to be merged, it just demonstrates how this feature can be used. This series applies on top of v5 of the "kexec_file_load implementation for PowerPC" patch series (which applies on top of v4.8-rc1): https://lists.infradead.org/pipermail/kexec/2016-August/016843.html Changes for v2: - Rebased on v5 of kexec_file_load implementation for PowerPC patch series. - Patch "kexec_file: Add buffer hand-over support for the next kernel" - Changed kexec_add_handover_buffer to receive a struct kexec_buf, as suggested by Dave Young. - Patch "powerpc: kexec_file: Add buffer hand-over support for the next kernel" - Moved setup_handover_buffer from kexec_elf_64.c to machine_kexec_64.c. - Call setup_handover_buffer from setup_new_fdt instead of elf64_load. - Changed kexec_get_handover_buffer to read from the expanded device tree instead of the flattened device tree. - Patch "kexec_file: Add mechanism to update kexec segments.": - Removed unnecessary "#include " in kexec_file.c. - Round up memsz argument to PAGE_SIZE. - Check if kexec_image is NULL in kexec_update_segment. - Patch "IMA: Demonstration code for kexec buffer passing." - Avoid registering reboot notifier again if kexec_file_load is called more than once. Thiago Jung Bauermann (6): kexec_file: Add buffer hand-over support for the next kernel powerpc: kexec_file: Add buffer hand-over support for the next kernel kexec_file: Allow skipping checksum calculation for some segments. kexec_file: Add mechanism to update kexec segments. kexec: Share logic to copy segment page contents. IMA: Demonstration code for kexec buffer passing. arch/powerpc/include/asm/kexec.h | 12 +- arch/powerpc/kernel/kexec_elf_64.c | 8 +- arch/powerpc/kernel/machine_kexec_64.c | 114 ++++++++++++++++- arch/x86/kernel/crash.c | 4 +- arch/x86/kernel/kexec-bzimage64.c | 6 +- include/linux/ima.h | 11 ++ include/linux/kexec.h | 37 +++++- kernel/kexec_core.c | 216 ++++++++++++++++++++++++++------- kernel/kexec_file.c | 91 ++++++++++++-- security/integrity/ima/ima.h | 5 + security/integrity/ima/ima_init.c | 26 ++++ security/integrity/ima/ima_template.c | 85 +++++++++++++ 12 files changed, 546 insertions(+), 69 deletions(-) -- 1.9.1