From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYPTi-000689-R5 for kexec@lists.infradead.org; Sat, 13 Aug 2016 03:19:20 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7D3Iqkk141588 for ; Fri, 12 Aug 2016 23:18:56 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0b-001b2d01.pphosted.com with ESMTP id 24scsjayw8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 12 Aug 2016 23:18:56 -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:54 -0300 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 5FF031DC0051 for ; Fri, 12 Aug 2016 23:18:43 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7D3Iq6c10223880 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 u7D3Ioe1013768 for ; Sat, 13 Aug 2016 00:18:52 -0300 From: 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: kexec@lists.infradead.org Cc: Benjamin Herrenschmidt , Balbir Singh , Paul Mackerras , "H. Peter Anvin" , linux-ima-devel@lists.sourceforge.net, Stewart Smith , Baoquan He , Michael Ellerman , x86@kernel.org, Ingo Molnar , Thiago Jung Bauermann , Mimi Zohar , Vivek Goyal , Petko Manolov , Thomas Gleixner , Eric Richter , Dave Young , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, David Laight , Eric Biederman , Andrew Morton , Samuel Mendoza-Jonas , linuxppc-dev@lists.ozlabs.org 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 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec