From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
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,
Eric Biederman <ebiederm@xmission.com>,
Dave Young <dyoung@redhat.com>, Vivek Goyal <vgoyal@redhat.com>,
Baoquan He <bhe@redhat.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Stewart Smith <stewart@linux.vnet.ibm.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Eric Richter <erichte@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Balbir Singh <bsingharora@gmail.com>,
Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: [PATCH v4 0/5] kexec_file: Add buffer hand-over for the next kernel
Date: Tue, 30 Aug 2016 14:45:00 -0300 [thread overview]
Message-ID: <1472579105-26296-1-git-send-email-bauerman@linux.vnet.ibm.com> (raw)
Hello,
The purpose of this new version of the series is to fix a small issue that
I found, which is that the kernel doesn't remove the memory reservation
for the hand-over buffer it received from the previous kernel in the
device tree it sets up for the next kernel. The result is that for each
successive kexec, a stale hand-over buffer is left behind, wasting memory.
This is fixed by changes to kexec_free_handover_buffer and
setup_handover_buffer in patch 2. The other change is to fix checkpatch
warnings in the last patch.
Original cover letter:
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.
The last patch is not intended to be merged, it just demonstrates how
this feature can be used.
This series applies on top of v6 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/016960.html
Changes for v4:
- Rebased series on kexec_file_load patch series v7.
- Patch "powerpc: kexec_file: Add buffer hand-over support for the next kernel"
- Convert hand-over buffer address to physical address when calling
memblock_free in kexec_free_handover_buffer.
- Delete hand-over buffer properties from the live device tree in
kexec_free_handover_buffer.
- Remove the memory reservation and the properties for the hand-over
buffer received from the previous kernel in setup_handover_buffer.
- Patch "IMA: Demonstration code for kexec buffer passing."
- Fix checkpatch warnings. (Andrew Morton)
Changes for v3:
- Rebased series on kexec_file_load patch series v6.
Both patch series apply cleanly on todays' Linus master branch, except
for a few lines of fuzz in arch/powerpc/Makefile and arch/powerpc/Kconfig.
- Patch "kexec_file: Add buffer hand-over support for the next kernel"
- Fix compilation warning in <linux/kexec.h> by adding a struct kexec_buf
forward declaration when CONFIG_KEXEC_FILE=n. (Fenguang Wu)
- Patch "kexec_file: Allow skipping checksum calculation for some segments."
- Substitute checksum argument in kexec_add_buffer with skip_checksum
member in struct kexec_buf, as suggested by Dave Young.
- Patch "kexec_file: Add mechanism to update kexec segments."
- Use kmap_atomic in kexec_update_segment, as suggested by Andrew Morton.
- Fix build warning on m68k by passing unsigned long value to __va instead
of void *. (Fenguang Wu)
- Change bufsz and memsz arguments of kexec_update_segment to size_t to fix
compilation warning. (Fenguang Wu)
- Patch "kexec: Share logic to copy segment page contents."
- Dropped this patch.
- Patch "IMA: Demonstration code for kexec buffer passing."
- Update to use kexec_buf.skip_checksum instead of passing it in
kexec_add_buffer.
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 <linux/highmem.h>" 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 (5):
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.
IMA: Demonstration code for kexec buffer passing.
arch/powerpc/include/asm/kexec.h | 12 +-
arch/powerpc/kernel/kexec_elf_64.c | 2 +-
arch/powerpc/kernel/machine_kexec_64.c | 274 +++++++++++++++++++++++++++------
include/linux/ima.h | 11 ++
include/linux/kexec.h | 56 +++++--
kernel/kexec_core.c | 98 ++++++++++++
kernel/kexec_file.c | 87 ++++++++++-
security/integrity/ima/ima.h | 5 +
security/integrity/ima/ima_init.c | 26 ++++
security/integrity/ima/ima_template.c | 85 ++++++++++
10 files changed, 591 insertions(+), 65 deletions(-)
--
1.9.1
next reply other threads:[~2016-08-30 17:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 17:45 Thiago Jung Bauermann [this message]
2016-08-30 17:45 ` [PATCH v4 1/5] kexec_file: Add buffer hand-over support for the next kernel Thiago Jung Bauermann
2016-08-30 17:45 ` [PATCH v4 2/5] powerpc: " Thiago Jung Bauermann
2016-08-30 17:45 ` [PATCH v4 3/5] kexec_file: Allow skipping checksum calculation for some segments Thiago Jung Bauermann
2016-09-07 1:30 ` Eric W. Biederman
2016-08-30 17:45 ` [PATCH v4 4/5] kexec_file: Add mechanism to update kexec segments Thiago Jung Bauermann
2016-08-30 17:45 ` [PATCH v4 5/5] IMA: Demonstration code for kexec buffer passing Thiago Jung Bauermann
2016-09-07 13:51 ` [PATCH v4 0/5] kexec_file: Add buffer hand-over for the next kernel Eric W. Biederman
2016-09-07 14:19 ` Eric W. Biederman
2016-09-08 19:20 ` Thiago Jung Bauermann
2016-09-09 4:07 ` Eric W. Biederman
2016-09-09 13:08 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472579105-26296-1-git-send-email-bauerman@linux.vnet.ibm.com \
--to=bauerman@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=bsingharora@gmail.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=erichte@linux.vnet.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-ima-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=stewart@linux.vnet.ibm.com \
--cc=vgoyal@redhat.com \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).