Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1719712
| From | AKASHI Takahiro <takahiro.akashi@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 13/14] arm64: kexec_file: add Image format support |
| Date | 2017-08-25 04:00 +0200 |
| Message-ID | <uic4F-63E-5@gated-at.bofh.it> (permalink) |
| References | <uhVwR-3Wx-1@gated-at.bofh.it> <uhVGy-405-17@gated-at.bofh.it> <ui478-14g-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 24, 2017 at 06:23:37PM +0100, Mark Rutland wrote:
> On Thu, Aug 24, 2017 at 05:18:10PM +0900, AKASHI Takahiro wrote:
> > The "Image" binary will be loaded at the offset of TEXT_OFFSET from
> > the start of system memory. TEXT_OFFSET is basically determined from
> > the header of the image.
>
> What's the policy for the binary types kexec_file_load() will load, and
> how are these identified? AFAICT, there are no flags, so it looks like
> we're just checking the magic and hoping.
Yes, please see image_probe().
> > Regarding kernel verification, it will be done through
> > verify_pefile_signature() as arm64's "Image" binary can be seen as
> > in PE format. This approach is consistent with x86 implementation.
>
> This will not work for kernels built without CONFIG_EFI, where we don't
> have a PE header.
Right.
> What happens in that case?
In this case, we cannot find a signature in the binary when loading,
so kexec just fails.
Signature is a must if the kernel is configured with KEXEC_FILE_VERIFY.
Thanks,
-Takahiro AKASHI
> [...]
>
> > +/**
> > + * arm64_header_check_msb - Helper to check the arm64 image header.
> > + *
> > + * Returns non-zero if the image was built as big endian.
> > + */
> > +
> > +static inline int arm64_header_check_msb(const struct arm64_image_header *h)
> > +{
> > + if (!h)
> > + return 0;
> > +
> > + return !!(h->flags[7] & arm64_image_flag_7_be);
> > +}
>
> What are we going to use this for?
Nowhere. I forgot to remove it.
> In kernel, we use the term "BE" rather than "MSB", and it's unfortunate
> to have code with varying naming conventions.
>
> [...]
>
> > +static void *image_load(struct kimage *image, char *kernel,
> > + unsigned long kernel_len, char *initrd,
> > + unsigned long initrd_len, char *cmdline,
> > + unsigned long cmdline_len)
> > +{
> > + struct kexec_buf kbuf;
> > + struct arm64_image_header *h = (struct arm64_image_header *)kernel;
> > + unsigned long text_offset, kernel_load_addr;
> > + int ret;
> > +
> > + /* Create elf core header segment */
> > + ret = load_crashdump_segments(image);
> > + if (ret)
> > + goto out;
> > +
> > + /* Load the kernel */
> > + kbuf.image = image;
> > + if (image->type == KEXEC_TYPE_CRASH) {
> > + kbuf.buf_min = crashk_res.start;
> > + kbuf.buf_max = crashk_res.end + 1;
> > + } else {
> > + kbuf.buf_min = 0;
> > + kbuf.buf_max = ULONG_MAX;
> > + }
> > + kbuf.top_down = 0;
> > +
> > + kbuf.buffer = kernel;
> > + kbuf.bufsz = kernel_len;
> > + if (h->image_size) {
> > + kbuf.memsz = le64_to_cpu(h->image_size);
> > + text_offset = le64_to_cpu(h->text_offset);
> > + } else {
> > + /* v3.16 or older */
> > + kbuf.memsz = kbuf.bufsz; /* NOTE: not including BSS */
>
> Why bother supporting < 3.16 kernels?
Because kexec-tools does :)
> They predate regulate kexec, we know we don't have enough information to
> boot such kernels reliably, and arguably attempting to load one would
> indicate some kind of rollback attack.
Around the time when Geoff were originally working on kexec,
there might be some possibility that people might want to boot a bit older
kernel, I guess.
Thanks,
-Takahiro AKASHI
> Thanks,
> Mark.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/14] arm64: kexec: add kexec_file_load support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:20 +0200
[PATCH 14/14] arm64: kexec_file: add vmlinux format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:20 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support Mark Rutland <mark.rutland@arm.com> - 2017-08-24 19:40 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 04:10 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support Dave Young <dyoung@redhat.com> - 2017-08-25 08:20 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 05:00 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support Mark Rutland <mark.rutland@arm.com> - 2017-08-29 12:10 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-29 18:20 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support Michael Ellerman <mpe@ellerman.id.au> - 2017-08-30 10:50 +0200
Re: [PATCH 14/14] arm64: kexec_file: add vmlinux format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 05:10 +0200
[PATCH 08/14] arm64: kexec_file: create purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:20 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-08-24 11:20 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:20 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory Mark Rutland <mark.rutland@arm.com> - 2017-08-24 19:00 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:10 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory Mark Rutland <mark.rutland@arm.com> - 2017-08-25 12:30 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-08-25 18:20 +0200
Re: [PATCH 08/14] arm64: kexec_file: create purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 04:50 +0200
[PATCH 02/14] include: pe.h: remove message[] from mz header definition AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:20 +0200
Re: [PATCH 02/14] include: pe.h: remove message[] from mz header definition Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-08-24 11:10 +0200
[PATCH 01/14] MODSIGN: Export module signature definitions AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:20 +0200
[PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-08-24 11:20 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:30 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory Mark Rutland <mark.rutland@arm.com> - 2017-08-24 19:10 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:30 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory Mark Rutland <mark.rutland@arm.com> - 2017-08-25 12:50 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 04:50 +0200
Re: [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-09-08 18:00 +0200
[PATCH 07/14] asm-generic: add kexec_file_load system call to unistd.h AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 07/14] asm-generic: add kexec_file_load system call to unistd.h Arnd Bergmann <arnd@arndb.de> - 2017-08-24 13:00 +0200
[PATCH 13/14] arm64: kexec_file: add Image format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 13/14] arm64: kexec_file: add Image format support Mark Rutland <mark.rutland@arm.com> - 2017-08-24 19:30 +0200
Re: [PATCH 13/14] arm64: kexec_file: add Image format support AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 04:00 +0200
[PATCH 03/14] resource: add walk_system_ram_res_rev() AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 03/14] resource: add walk_system_ram_res_rev() Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-08-24 11:10 +0200
Re: [PATCH 03/14] resource: add walk_system_ram_res_rev() AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:00 +0200
Re: [PATCH 03/14] resource: add walk_system_ram_res_rev() Pratyush Anand <panand@redhat.com> - 2017-08-31 04:40 +0200
Re: [PATCH 03/14] resource: add walk_system_ram_res_rev() AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 04:40 +0200
[PATCH 10/14] arm64: kexec_file: load initrd, device-tree and purgatory segments AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 10/14] arm64: kexec_file: load initrd, device-tree and purgatory segments Mark Rutland <mark.rutland@arm.com> - 2017-08-24 19:20 +0200
Re: [PATCH 10/14] arm64: kexec_file: load initrd, device-tree and purgatory segments AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-25 03:40 +0200
[PATCH 04/14] kexec_file: factor out vmlinux (elf) parser from powerpc AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
[PATCH 05/14] kexec_file: factor out crashdump elf header function from x86 AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
Re: [PATCH 05/14] kexec_file: factor out crashdump elf header function from x86 Dave Young <dyoung@redhat.com> - 2017-08-25 07:50 +0200
Re: [PATCH 05/14] kexec_file: factor out crashdump elf header function from x86 AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-09-08 04:30 +0200
[PATCH 06/14] kexec_file: add kexec_add_segment() AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
[PATCH 12/14] arm64: enable KEXEC_FILE config AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
[PATCH 11/14] arm64: kexec_file: set up for crash dump adding elf core header AKASHI Takahiro <takahiro.akashi@linaro.org> - 2017-08-24 10:30 +0200
csiph-web