All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] arm64: kexec: add kexec_file_load support
@ 2017-08-24  8:17 ` AKASHI Takahiro
  0 siblings, 0 replies; 147+ messages in thread
From: AKASHI Takahiro @ 2017-08-24  8:17 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, bauerman, dhowells, vgoyal,
	herbert, davem, akpm, mpe, dyoung, bhe, arnd, ard.biesheuvel
  Cc: kexec, linux-arm-kernel, linux-kernel, AKASHI Takahiro

This is the initial attempt of implementing kexec_file_load() support
on arm64.[1]
Most of the code is based on kexec-tools (along with some kernel code
from x86 and from powerpc, which also came from kexec-tools).


This patch series enables us to
  * load the kernel, either Image or vmlinux, with kexec_file_load
    system call, and
  * optionally verify its signature at load time for trusted boot.

To load the kernel via kexec_file_load system call, a small change
needs to be applied on kexec-tools. See [2]. This enables '-s' option.

As we discussed a long time ago, users may not be allowed to specify
device-tree file of the 2nd kernel explicitly with kexec-tools, therefore
re-using the blob of the first kernel.

Regarding a method of placing the signature into the kernel binary,
  * for 'Image', we conform with x86 (or rather Microsoft?) style of
    signing since the binary can also be seen as in PE format
    (assuming that CONFIG_EFI is enabled),
  * for 'vmlinux', we follow powerpc approach[3]: The signature will
    be appended just after the binary itself as module signing does.
    This implies that we need to enable CONFIG_MODULE_SIG, too.

    Powerpc is also going to support extended-file-attribute-based
    verification[3], but arm64 doesn't for now partly because we don't
    have TPM-based IMA at this moment.

Accordingly, we can use the existing commands, sbsign and sig-file
respectively, to sign the kernel. Please note that it is totally up to
the system what key/certificate is used for signing.

Some concerns(or future works):
* Even if the kernel is configured with CONFIG_RANDOMIZE_BASE, the 2nd
  kernel won't be placed at a randomized address. We will have to
  add some boot code similar to efi-stub to implement the feature.
* While big-endian kernel can support kernel signing, I'm not sure that
  Image can be recognized as in PE format because x86 standard only
  defines little-endian-based format.
  So I tested big-endian kernel signing only with vmlinux.
* IMA(and file extended attribute)-based kexec


Patch #1 to #7 are all preparatory patches on generic side.
(Patch #1 is not part of mine, but a prerequisite from [4].)
Patch #8 and #9 are purgatory code.
Patch #10 to #12 are common for enabling kexec_file_load.
Patch #13 is for 'Image' support.
Patch #14 is for 'vmlinux' support.


  [1] http://git.linaro.org/people/takahiro.akashi/linux-aarch64.git
	branch:arm64/kexec_file
  [2] http://git.linaro.org/people/takahiro.akashi/kexec-tools.git
	branch:arm64/kexec_file
  [3] http://lkml.iu.edu//hypermail/linux/kernel/1707.0/03669.html
  [4] http://lkml.iu.edu//hypermail/linux/kernel/1707.0/03670.html


AKASHI Takahiro (13):
  include: pe.h: remove message[] from mz header definition
  resource: add walk_system_ram_res_rev()
  kexec_file: factor out vmlinux (elf) parser from powerpc
  kexec_file: factor out crashdump elf header function from x86
  kexec_file: add kexec_add_segment()
  asm-generic: add kexec_file_load system call to unistd.h
  arm64: kexec_file: create purgatory
  arm64: kexec_file: add sha256 digest check in purgatory
  arm64: kexec_file: load initrd, device-tree and purgatory segments
  arm64: kexec_file: set up for crash dump adding elf core header
  arm64: enable KEXEC_FILE config
  arm64: kexec_file: add Image format support
  arm64: kexec_file: add vmlinux format support

Thiago Jung Bauermann (1):
  MODSIGN: Export module signature definitions

 arch/Kconfig                            |   3 +
 arch/arm64/Kconfig                      |  33 ++
 arch/arm64/Makefile                     |   1 +
 arch/arm64/crypto/sha256-core.S_shipped |   2 +
 arch/arm64/include/asm/kexec.h          |  23 ++
 arch/arm64/include/asm/kexec_file.h     |  84 +++++
 arch/arm64/kernel/Makefile              |   5 +-
 arch/arm64/kernel/kexec_elf.c           | 216 ++++++++++++
 arch/arm64/kernel/kexec_image.c         | 112 ++++++
 arch/arm64/kernel/machine_kexec_file.c  | 606 ++++++++++++++++++++++++++++++++
 arch/arm64/purgatory/Makefile           |  43 +++
 arch/arm64/purgatory/entry.S            |  41 +++
 arch/arm64/purgatory/purgatory.c        |  20 ++
 arch/arm64/purgatory/sha256-core.S      |   1 +
 arch/arm64/purgatory/sha256.c           |  79 +++++
 arch/arm64/purgatory/sha256.h           |   1 +
 arch/arm64/purgatory/string.c           |  32 ++
 arch/arm64/purgatory/string.h           |   5 +
 arch/powerpc/Kconfig                    |   1 +
 arch/powerpc/kernel/kexec_elf_64.c      | 464 ------------------------
 arch/x86/kernel/crash.c                 | 324 -----------------
 include/linux/elf.h                     |  62 ++++
 include/linux/ioport.h                  |   3 +
 include/linux/kexec.h                   |  39 ++
 include/linux/module.h                  |   3 -
 include/linux/module_signature.h        |  47 +++
 include/linux/pe.h                      |   2 +-
 include/uapi/asm-generic/unistd.h       |   4 +-
 init/Kconfig                            |   6 +-
 kernel/Makefile                         |   3 +-
 kernel/crash_core.c                     | 333 ++++++++++++++++++
 kernel/kexec_file.c                     |  47 +++
 kernel/kexec_file_elf.c                 | 454 ++++++++++++++++++++++++
 kernel/module.c                         |   1 +
 kernel/module_signing.c                 |  74 ++--
 kernel/resource.c                       |  48 +++
 36 files changed, 2383 insertions(+), 839 deletions(-)
 create mode 100644 arch/arm64/include/asm/kexec_file.h
 create mode 100644 arch/arm64/kernel/kexec_elf.c
 create mode 100644 arch/arm64/kernel/kexec_image.c
 create mode 100644 arch/arm64/kernel/machine_kexec_file.c
 create mode 100644 arch/arm64/purgatory/Makefile
 create mode 100644 arch/arm64/purgatory/entry.S
 create mode 100644 arch/arm64/purgatory/purgatory.c
 create mode 100644 arch/arm64/purgatory/sha256-core.S
 create mode 100644 arch/arm64/purgatory/sha256.c
 create mode 100644 arch/arm64/purgatory/sha256.h
 create mode 100644 arch/arm64/purgatory/string.c
 create mode 100644 arch/arm64/purgatory/string.h
 create mode 100644 include/linux/module_signature.h
 create mode 100644 kernel/kexec_file_elf.c

-- 
2.14.1

^ permalink raw reply	[flat|nested] 147+ messages in thread

end of thread, other threads:[~2017-09-08 16:00 UTC | newest]

Thread overview: 147+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  8:17 [PATCH 00/14] arm64: kexec: add kexec_file_load support AKASHI Takahiro
2017-08-24  8:17 ` AKASHI Takahiro
2017-08-24  8:17 ` AKASHI Takahiro
2017-08-24  8:17 ` [PATCH 01/14] MODSIGN: Export module signature definitions AKASHI Takahiro
2017-08-24  8:17   ` AKASHI Takahiro
2017-08-24  8:17   ` AKASHI Takahiro
2017-08-24  8:17 ` [PATCH 02/14] include: pe.h: remove message[] from mz header definition AKASHI Takahiro
2017-08-24  8:17   ` AKASHI Takahiro
2017-08-24  8:17   ` AKASHI Takahiro
2017-08-24  9:04   ` Ard Biesheuvel
2017-08-24  9:04     ` Ard Biesheuvel
2017-08-24  9:04     ` Ard Biesheuvel
2017-08-24  8:18 ` [PATCH 03/14] resource: add walk_system_ram_res_rev() AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  9:06   ` Ard Biesheuvel
2017-08-24  9:06     ` Ard Biesheuvel
2017-08-24  9:06     ` Ard Biesheuvel
2017-08-25  0:50     ` AKASHI Takahiro
2017-08-25  0:50       ` AKASHI Takahiro
2017-08-25  0:50       ` AKASHI Takahiro
2017-08-31  2:34   ` Pratyush Anand
2017-08-31  2:34     ` Pratyush Anand
2017-08-31  2:34     ` Pratyush Anand
2017-09-08  2:33     ` AKASHI Takahiro
2017-09-08  2:33       ` AKASHI Takahiro
2017-09-08  2:33       ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 04/14] kexec_file: factor out vmlinux (elf) parser from powerpc AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 05/14] kexec_file: factor out crashdump elf header function from x86 AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-25  5:47   ` Dave Young
2017-08-25  5:47     ` Dave Young
2017-08-25  5:47     ` Dave Young
2017-09-08  2:31     ` AKASHI Takahiro
2017-09-08  2:31       ` AKASHI Takahiro
2017-09-08  2:31       ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 06/14] kexec_file: add kexec_add_segment() AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 07/14] asm-generic: add kexec_file_load system call to unistd.h AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24 10:53   ` Arnd Bergmann
2017-08-24 10:53     ` Arnd Bergmann
2017-08-24 10:53     ` Arnd Bergmann
2017-08-24  8:18 ` [PATCH 08/14] arm64: kexec_file: create purgatory AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  9:10   ` Ard Biesheuvel
2017-08-24  9:10     ` Ard Biesheuvel
2017-08-24  9:10     ` Ard Biesheuvel
2017-08-25  1:10     ` AKASHI Takahiro
2017-08-25  1:10       ` AKASHI Takahiro
2017-08-25  1:10       ` AKASHI Takahiro
2017-08-24 16:56   ` Mark Rutland
2017-08-24 16:56     ` Mark Rutland
2017-08-24 16:56     ` Mark Rutland
2017-08-25  1:00     ` AKASHI Takahiro
2017-08-25  1:00       ` AKASHI Takahiro
2017-08-25  1:00       ` AKASHI Takahiro
2017-08-25 10:22       ` Mark Rutland
2017-08-25 10:22         ` Mark Rutland
2017-08-25 10:22         ` Mark Rutland
2017-08-25 16:16         ` Thiago Jung Bauermann
2017-08-25 16:16           ` Thiago Jung Bauermann
2017-08-25 16:16           ` Thiago Jung Bauermann
2017-09-08  2:46           ` AKASHI Takahiro
2017-09-08  2:46             ` AKASHI Takahiro
2017-09-08  2:46             ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 09/14] arm64: kexec_file: add sha256 digest check in purgatory AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  9:13   ` Ard Biesheuvel
2017-08-24  9:13     ` Ard Biesheuvel
2017-08-24  9:13     ` Ard Biesheuvel
2017-08-25  1:25     ` AKASHI Takahiro
2017-08-25  1:25       ` AKASHI Takahiro
2017-08-25  1:25       ` AKASHI Takahiro
2017-08-24 17:04   ` Mark Rutland
2017-08-24 17:04     ` Mark Rutland
2017-08-24 17:04     ` Mark Rutland
2017-08-25  1:21     ` AKASHI Takahiro
2017-08-25  1:21       ` AKASHI Takahiro
2017-08-25  1:21       ` AKASHI Takahiro
2017-08-25 10:41       ` Mark Rutland
2017-08-25 10:41         ` Mark Rutland
2017-08-25 10:41         ` Mark Rutland
2017-09-08  2:50         ` AKASHI Takahiro
2017-09-08  2:50           ` AKASHI Takahiro
2017-09-08  2:50           ` AKASHI Takahiro
2017-09-08 15:59           ` Thiago Jung Bauermann
2017-09-08 15:59             ` Thiago Jung Bauermann
2017-09-08 15:59             ` Thiago Jung Bauermann
2017-08-24  8:18 ` [PATCH 10/14] arm64: kexec_file: load initrd, device-tree and purgatory segments AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24 17:11   ` Mark Rutland
2017-08-24 17:11     ` Mark Rutland
2017-08-24 17:11     ` Mark Rutland
2017-08-25  1:34     ` AKASHI Takahiro
2017-08-25  1:34       ` AKASHI Takahiro
2017-08-25  1:34       ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 11/14] arm64: kexec_file: set up for crash dump adding elf core header AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 12/14] arm64: enable KEXEC_FILE config AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 13/14] arm64: kexec_file: add Image format support AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24 17:23   ` Mark Rutland
2017-08-24 17:23     ` Mark Rutland
2017-08-24 17:23     ` Mark Rutland
2017-08-25  1:49     ` AKASHI Takahiro
2017-08-25  1:49       ` AKASHI Takahiro
2017-08-25  1:49       ` AKASHI Takahiro
2017-08-24  8:18 ` [PATCH 14/14] arm64: kexec_file: add vmlinux " AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24  8:18   ` AKASHI Takahiro
2017-08-24 17:30   ` Mark Rutland
2017-08-24 17:30     ` Mark Rutland
2017-08-24 17:30     ` Mark Rutland
2017-08-25  2:03     ` AKASHI Takahiro
2017-08-25  2:03       ` AKASHI Takahiro
2017-08-25  2:03       ` AKASHI Takahiro
2017-08-25  6:13       ` Dave Young
2017-08-25  6:13         ` Dave Young
2017-08-25  6:13         ` Dave Young
2017-09-08  2:54         ` AKASHI Takahiro
2017-09-08  2:54           ` AKASHI Takahiro
2017-09-08  2:54           ` AKASHI Takahiro
2017-08-29 10:01     ` Mark Rutland
2017-08-29 10:01       ` Mark Rutland
2017-08-29 10:01       ` Mark Rutland
2017-08-29 16:15       ` Thiago Jung Bauermann
2017-08-29 16:15         ` Thiago Jung Bauermann
2017-08-29 16:15         ` Thiago Jung Bauermann
2017-08-30  8:40       ` Michael Ellerman
2017-08-30  8:40         ` Michael Ellerman
2017-08-30  8:40         ` Michael Ellerman
2017-09-08  3:07       ` AKASHI Takahiro
2017-09-08  3:07         ` AKASHI Takahiro
2017-09-08  3:07         ` AKASHI Takahiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.