Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1656225 > unrolled thread
| Started by | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| First post | 2017-06-02 16:00 +0200 |
| Last post | 2017-06-05 18:00 +0200 |
| Articles | 20 on this page of 30 — 7 participants |
Back to article view | Back to linux.kernel
[GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[PATCH 07/13] efi/capsule: Remove NULL test on kmap() Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule: Remove NULL test on kmap() tip-bot for Fabian Frederick <tipbot@zytor.com> - 2017-06-05 19:20 +0200
[PATCH 13/13] efi: arm: enable DMI/SMBIOS Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/arm: Enable DMI/SMBIOS tip-bot for Ard Biesheuvel <tipbot@zytor.com> - 2017-06-05 19:30 +0200
[PATCH 03/13] efi/capsule: Remove pr_debug on ENOMEM or EFAULT Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule: Remove pr_debug() on ENOMEM or EFAULT tip-bot for Jan Kiszka <tipbot@zytor.com> - 2017-06-05 19:20 +0200
[PATCH 02/13] efi/capsule: Fix return code on failing kmap/vmap Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule: Fix return code on failing kmap/vmap tip-bot for Jan Kiszka <tipbot@zytor.com> - 2017-06-05 19:20 +0200
[PATCH 10/13] efi/capsule: Add support for Quark security header Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
Re: [PATCH 10/13] efi/capsule: Add support for Quark security header Ingo Molnar <mingo@kernel.org> - 2017-06-05 18:00 +0200
Re: [PATCH 10/13] efi/capsule: Add support for Quark security header Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-05 18:10 +0200
Re: [PATCH 10/13] efi/capsule: Add support for Quark security header Ingo Molnar <mingo@kernel.org> - 2017-06-05 18:20 +0200
[tip:efi/core] efi/capsule: Add support for Quark security header tip-bot for Jan Kiszka <tipbot@zytor.com> - 2017-06-05 19:30 +0200
[PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Ingo Molnar <mingo@kernel.org> - 2017-06-05 17:50 +0200
Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-05 18:10 +0200
Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore Andy Lutomirski <luto@kernel.org> - 2017-06-05 18:20 +0200
[PATCH 04/13] efi/capsule: Clean up pr_err/info messages Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule: Clean up pr_err/_info() messages tip-bot for Jan Kiszka <tipbot@zytor.com> - 2017-06-05 19:20 +0200
[PATCH 12/13] x86/efi: Add EFI_PGT_DUMP support for x86_32 and kexec Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] x86/efi: Extend CONFIG_EFI_PGT_DUMP support to x86_32 and kexec as well tip-bot for Sai Praneeth <tipbot@zytor.com> - 2017-06-05 19:30 +0200
[PATCH 05/13] efi/capsule: Adjust return type of efi_capsule_setup_info Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule: Adjust return type of efi_capsule_setup_info() tip-bot for Jan Kiszka <tipbot@zytor.com> - 2017-06-05 19:20 +0200
[PATCH 09/13] efi/capsule-loader: Use page addresses rather than struct page pointers Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-02 16:00 +0200
[tip:efi/core] efi/capsule-loader: Use page addresses rather than struct page pointers tip-bot for Ard Biesheuvel <tipbot@zytor.com> - 2017-06-05 19:30 +0200
Re: [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-05 10:20 +0200
Re: [GIT PULL 00/13] First batch of EFI updates for v4.13 Ingo Molnar <mingo@kernel.org> - 2017-06-05 11:10 +0200
Re: [GIT PULL 00/13] First batch of EFI updates for v4.13 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-05 11:40 +0200
Re: [GIT PULL 00/13] First batch of EFI updates for v4.13 Ingo Molnar <mingo@kernel.org> - 2017-06-05 18:00 +0200
Page 1 of 2 [1] 2 Next page →
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [GIT PULL 00/13] First batch of EFI updates for v4.13 |
| Message-ID | <tNVho-1Vg-11@gated-at.bofh.it> |
The following changes since commit 5ed02dbb497422bf225783f46e6eadd237d23d6b:
Linux 4.12-rc3 (2017-05-28 17:20:53 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-next
for you to fetch changes up to 3acbd5a24ab9d9a82c56d9018f4d340fa574b91d:
efi: arm: enable DMI/SMBIOS (2017-06-02 13:38:56 +0000)
----------------------------------------------------------------
First batch of EFI changes for v4.13:
- rework the EFI capsule loader to allow for workarounds for non-compliant
firmware to be implemented more easily and in a more self contained
manner (Ard)
- implement a capsule loader quirk for Quark X102x, which prepends a
security header in a non-compliant way (Jan Kiszka)
- enable SMBIOS/DMI support for the ARM architecture (Ard)
- add EFI_PGT_DUMP support for x86_32 and kexec (Sai Praneeth)
- some other cleanups
----------------------------------------------------------------
Andy Lutomirski (1):
x86/efi: Clean up efi CR3 save/restore
Ard Biesheuvel (4):
efi/capsule-loader: Use a cached copy of the capsule header
efi/capsule-loader: Redirect calls to efi_capsule_setup_info via weak alias
efi/capsule-loader: Use page addresses rather than struct page pointers
efi: arm: enable DMI/SMBIOS
Fabian Frederick (1):
efi/capsule: Remove NULL test on kmap()
Geliang Tang (1):
efi/efi_test: Use memdup_user() helper
Jan Kiszka (5):
efi/capsule: Fix return code on failing kmap/vmap
efi/capsule: Remove pr_debug on ENOMEM or EFAULT
efi/capsule: Clean up pr_err/info messages
efi/capsule: Adjust return type of efi_capsule_setup_info
efi/capsule: Add support for Quark security header
Sai Praneeth (1):
x86/efi: Add EFI_PGT_DUMP support for x86_32 and kexec
arch/arm/Kconfig | 17 +++++
arch/arm/include/asm/dmi.h | 19 +++++
arch/arm64/kernel/efi.c | 15 ----
arch/x86/include/asm/efi.h | 17 ++++-
arch/x86/platform/efi/efi.c | 9 ++-
arch/x86/platform/efi/efi_32.c | 21 ++++--
arch/x86/platform/efi/efi_64.c | 27 ++++---
arch/x86/platform/efi/quirks.c | 137 ++++++++++++++++++++++++++++++++++
drivers/firmware/efi/Kconfig | 9 +++
drivers/firmware/efi/arm-runtime.c | 16 ++++
drivers/firmware/efi/capsule-loader.c | 117 ++++++++++++-----------------
drivers/firmware/efi/capsule.c | 11 +--
drivers/firmware/efi/test/efi_test.c | 11 +--
include/linux/efi.h | 14 +++-
14 files changed, 317 insertions(+), 123 deletions(-)
create mode 100644 arch/arm/include/asm/dmi.h
[toc] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 07/13] efi/capsule: Remove NULL test on kmap() |
| Message-ID | <tNVhp-1Vg-27@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Fabian Frederick <fabf@skynet.be>
kmap() can't fail.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Kweh Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/firmware/efi/capsule-loader.c | 4 ----
drivers/firmware/efi/capsule.c | 4 ----
2 files changed, 8 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 5b012a467d7d..2357bcdcb44d 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -170,10 +170,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
page = cap_info->pages[cap_info->index - 1];
kbuff = kmap(page);
- if (!kbuff) {
- ret = -ENOMEM;
- goto failed;
- }
kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
/* Copy capsule binary data from user space to kernel space buffer */
diff --git a/drivers/firmware/efi/capsule.c b/drivers/firmware/efi/capsule.c
index 6eedff45e6d7..e603ccf39d80 100644
--- a/drivers/firmware/efi/capsule.c
+++ b/drivers/firmware/efi/capsule.c
@@ -247,10 +247,6 @@ int efi_capsule_update(efi_capsule_header_t *capsule, struct page **pages)
efi_capsule_block_desc_t *sglist;
sglist = kmap(sg_pages[i]);
- if (!sglist) {
- rv = -ENOMEM;
- goto out;
- }
for (j = 0; j < SGLIST_PER_PAGE && count > 0; j++) {
u64 sz = min_t(u64, imagesize, PAGE_SIZE);
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Fabian Frederick <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:20 +0200 |
| Subject | [tip:efi/core] efi/capsule: Remove NULL test on kmap() |
| Message-ID | <tP3PB-5Lk-25@gated-at.bofh.it> |
| In reply to | #1656226 |
Commit-ID: 171fd0222957abe28e6d78de667f457376f45cf1
Gitweb: http://git.kernel.org/tip/171fd0222957abe28e6d78de667f457376f45cf1
Author: Fabian Frederick <fabf@skynet.be>
AuthorDate: Fri, 2 Jun 2017 13:52:01 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:40 +0200
efi/capsule: Remove NULL test on kmap()
kmap() can't fail.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Kweh Hock Leong <hock.leong.kweh@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-8-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/capsule-loader.c | 4 ----
drivers/firmware/efi/capsule.c | 4 ----
2 files changed, 8 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 5b012a4..2357bcd 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -170,10 +170,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
page = cap_info->pages[cap_info->index - 1];
kbuff = kmap(page);
- if (!kbuff) {
- ret = -ENOMEM;
- goto failed;
- }
kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
/* Copy capsule binary data from user space to kernel space buffer */
diff --git a/drivers/firmware/efi/capsule.c b/drivers/firmware/efi/capsule.c
index 6eedff4..e603ccf 100644
--- a/drivers/firmware/efi/capsule.c
+++ b/drivers/firmware/efi/capsule.c
@@ -247,10 +247,6 @@ int efi_capsule_update(efi_capsule_header_t *capsule, struct page **pages)
efi_capsule_block_desc_t *sglist;
sglist = kmap(sg_pages[i]);
- if (!sglist) {
- rv = -ENOMEM;
- goto out;
- }
for (j = 0; j < SGLIST_PER_PAGE && count > 0; j++) {
u64 sz = min_t(u64, imagesize, PAGE_SIZE);
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 13/13] efi: arm: enable DMI/SMBIOS |
| Message-ID | <tNVhp-1Vg-29@gated-at.bofh.it> |
| In reply to | #1656225 |
Wire up the existing arm64 support for SMBIOS tables (aka DMI) for ARM as
well, by moving the arm64 init code to drivers/firmware/efi/arm-runtime.c
(which is shared between ARM and arm64), and adding a asm/dmi.h header to
ARM that defines the mapping routines for the firmware tables.
This allows userspace to access these tables to discover system information
exposed by the firmware. It also sets the hardware name used in crash
dumps, e.g.,
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ed3c0000
[00000000] *pgd=bf1f3835
Internal error: Oops: 817 [#1] SMP THUMB2
Modules linked in:
CPU: 0 PID: 759 Comm: bash Not tainted 4.10.0-09601-g0e8f38792120-dirty #112
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
^^^
NOTE: This does *NOT* enable or encourage the use of DMI quirks, i.e., the
the practice of identifying the platform via DMI to decide whether
certain workarounds for buggy hardware and/or firmware need to be
enabled. This would require the DMI subsystem to be enabled much
earlier than we do on ARM, which is non-trivial.
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm/Kconfig | 17 +++++++++++++++++
arch/arm/include/asm/dmi.h | 19 +++++++++++++++++++
arch/arm64/kernel/efi.c | 15 ---------------
drivers/firmware/efi/arm-runtime.c | 16 ++++++++++++++++
4 files changed, 52 insertions(+), 15 deletions(-)
create mode 100644 arch/arm/include/asm/dmi.h
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4c1a35f15838..dabcaeb2ee3e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2061,6 +2061,23 @@ config EFI
is only useful for kernels that may run on systems that have
UEFI firmware.
+config DMI
+ bool "Enable support for SMBIOS (DMI) tables"
+ depends on EFI
+ default y
+ help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
+
+ NOTE: This does *NOT* enable or encourage the use of DMI quirks,
+ i.e., the the practice of identifying the platform via DMI to
+ decide whether certain workarounds for buggy hardware and/or
+ firmware need to be enabled. This would require the DMI subsystem
+ to be enabled much earlier than we do on ARM, which is non-trivial.
+
endmenu
menu "CPU Power Management"
diff --git a/arch/arm/include/asm/dmi.h b/arch/arm/include/asm/dmi.h
new file mode 100644
index 000000000000..df2d2ff06f5b
--- /dev/null
+++ b/arch/arm/include/asm/dmi.h
@@ -0,0 +1,19 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_DMI_H
+#define __ASM_DMI_H
+
+#include <linux/io.h>
+#include <linux/slab.h>
+
+#define dmi_early_remap(x, l) memremap(x, l, MEMREMAP_WB)
+#define dmi_early_unmap(x, l) memunmap(x)
+#define dmi_remap(x, l) memremap(x, l, MEMREMAP_WB)
+#define dmi_unmap(x) memunmap(x)
+#define dmi_alloc(l) kzalloc(l, GFP_KERNEL)
+
+#endif
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 5d17f377d905..82cd07592519 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -11,7 +11,6 @@
*
*/
-#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/init.h>
@@ -117,20 +116,6 @@ int __init efi_set_mapping_permissions(struct mm_struct *mm,
set_permissions, md);
}
-static int __init arm64_dmi_init(void)
-{
- /*
- * On arm64, DMI depends on UEFI, and dmi_scan_machine() needs to
- * be called early because dmi_id_init(), which is an arch_initcall
- * itself, depends on dmi_scan_machine() having been called already.
- */
- dmi_scan_machine();
- if (dmi_available)
- dmi_set_dump_stack_arch_desc();
- return 0;
-}
-core_initcall(arm64_dmi_init);
-
/*
* UpdateCapsule() depends on the system being shutdown via
* ResetSystem().
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
index 974c5a31a005..1cc41c3d6315 100644
--- a/drivers/firmware/efi/arm-runtime.c
+++ b/drivers/firmware/efi/arm-runtime.c
@@ -11,6 +11,7 @@
*
*/
+#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/io.h>
#include <linux/memblock.h>
@@ -166,3 +167,18 @@ void efi_virtmap_unload(void)
efi_set_pgd(current->active_mm);
preempt_enable();
}
+
+
+static int __init arm_dmi_init(void)
+{
+ /*
+ * On arm64/ARM, DMI depends on UEFI, and dmi_scan_machine() needs to
+ * be called early because dmi_id_init(), which is an arch_initcall
+ * itself, depends on dmi_scan_machine() having been called already.
+ */
+ dmi_scan_machine();
+ if (dmi_available)
+ dmi_set_dump_stack_arch_desc();
+ return 0;
+}
+core_initcall(arm_dmi_init);
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Ard Biesheuvel <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:30 +0200 |
| Subject | [tip:efi/core] efi/arm: Enable DMI/SMBIOS |
| Message-ID | <tP3Zi-5PM-57@gated-at.bofh.it> |
| In reply to | #1656227 |
Commit-ID: bb817bef3b1989a9cdb40362cfb8d2aa224ac1bc
Gitweb: http://git.kernel.org/tip/bb817bef3b1989a9cdb40362cfb8d2aa224ac1bc
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
AuthorDate: Fri, 2 Jun 2017 13:52:07 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:44 +0200
efi/arm: Enable DMI/SMBIOS
Wire up the existing arm64 support for SMBIOS tables (aka DMI) for ARM as
well, by moving the arm64 init code to drivers/firmware/efi/arm-runtime.c
(which is shared between ARM and arm64), and adding a asm/dmi.h header to
ARM that defines the mapping routines for the firmware tables.
This allows userspace to access these tables to discover system information
exposed by the firmware. It also sets the hardware name used in crash
dumps, e.g.:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ed3c0000
[00000000] *pgd=bf1f3835
Internal error: Oops: 817 [#1] SMP THUMB2
Modules linked in:
CPU: 0 PID: 759 Comm: bash Not tainted 4.10.0-09601-g0e8f38792120-dirty #112
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
^^^
NOTE: This does *NOT* enable or encourage the use of DMI quirks, i.e., the
the practice of identifying the platform via DMI to decide whether
certain workarounds for buggy hardware and/or firmware need to be
enabled. This would require the DMI subsystem to be enabled much
earlier than we do on ARM, which is non-trivial.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-14-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/arm/Kconfig | 17 +++++++++++++++++
arch/arm/include/asm/dmi.h | 19 +++++++++++++++++++
arch/arm64/kernel/efi.c | 15 ---------------
drivers/firmware/efi/arm-runtime.c | 16 ++++++++++++++++
4 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4c1a35f..dabcaeb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2061,6 +2061,23 @@ config EFI
is only useful for kernels that may run on systems that have
UEFI firmware.
+config DMI
+ bool "Enable support for SMBIOS (DMI) tables"
+ depends on EFI
+ default y
+ help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
+
+ NOTE: This does *NOT* enable or encourage the use of DMI quirks,
+ i.e., the the practice of identifying the platform via DMI to
+ decide whether certain workarounds for buggy hardware and/or
+ firmware need to be enabled. This would require the DMI subsystem
+ to be enabled much earlier than we do on ARM, which is non-trivial.
+
endmenu
menu "CPU Power Management"
diff --git a/arch/arm/include/asm/dmi.h b/arch/arm/include/asm/dmi.h
new file mode 100644
index 0000000..df2d2ff
--- /dev/null
+++ b/arch/arm/include/asm/dmi.h
@@ -0,0 +1,19 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_DMI_H
+#define __ASM_DMI_H
+
+#include <linux/io.h>
+#include <linux/slab.h>
+
+#define dmi_early_remap(x, l) memremap(x, l, MEMREMAP_WB)
+#define dmi_early_unmap(x, l) memunmap(x)
+#define dmi_remap(x, l) memremap(x, l, MEMREMAP_WB)
+#define dmi_unmap(x) memunmap(x)
+#define dmi_alloc(l) kzalloc(l, GFP_KERNEL)
+
+#endif
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 5d17f37..82cd075 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -11,7 +11,6 @@
*
*/
-#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/init.h>
@@ -117,20 +116,6 @@ int __init efi_set_mapping_permissions(struct mm_struct *mm,
set_permissions, md);
}
-static int __init arm64_dmi_init(void)
-{
- /*
- * On arm64, DMI depends on UEFI, and dmi_scan_machine() needs to
- * be called early because dmi_id_init(), which is an arch_initcall
- * itself, depends on dmi_scan_machine() having been called already.
- */
- dmi_scan_machine();
- if (dmi_available)
- dmi_set_dump_stack_arch_desc();
- return 0;
-}
-core_initcall(arm64_dmi_init);
-
/*
* UpdateCapsule() depends on the system being shutdown via
* ResetSystem().
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
index 974c5a3..1cc41c3 100644
--- a/drivers/firmware/efi/arm-runtime.c
+++ b/drivers/firmware/efi/arm-runtime.c
@@ -11,6 +11,7 @@
*
*/
+#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/io.h>
#include <linux/memblock.h>
@@ -166,3 +167,18 @@ void efi_virtmap_unload(void)
efi_set_pgd(current->active_mm);
preempt_enable();
}
+
+
+static int __init arm_dmi_init(void)
+{
+ /*
+ * On arm64/ARM, DMI depends on UEFI, and dmi_scan_machine() needs to
+ * be called early because dmi_id_init(), which is an arch_initcall
+ * itself, depends on dmi_scan_machine() having been called already.
+ */
+ dmi_scan_machine();
+ if (dmi_available)
+ dmi_set_dump_stack_arch_desc();
+ return 0;
+}
+core_initcall(arm_dmi_init);
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 03/13] efi/capsule: Remove pr_debug on ENOMEM or EFAULT |
| Message-ID | <tNVhp-1Vg-33@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Jan Kiszka <jan.kiszka@siemens.com>
Both cases are not worth a debug log message - the error code is telling
enough.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/firmware/efi/capsule-loader.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 91e91f7a8807..7b57dda2417d 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -88,10 +88,8 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
temp_page = krealloc(cap_info->pages,
pages_needed * sizeof(void *),
GFP_KERNEL | __GFP_ZERO);
- if (!temp_page) {
- pr_debug("%s: krealloc() failed\n", __func__);
+ if (!temp_page)
return -ENOMEM;
- }
cap_info->pages = temp_page;
cap_info->header_obtained = true;
@@ -111,10 +109,8 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
cap_hdr_temp = vmap(cap_info->pages, cap_info->index,
VM_MAP, PAGE_KERNEL);
- if (!cap_hdr_temp) {
- pr_debug("%s: vmap() failed\n", __func__);
+ if (!cap_hdr_temp)
return -ENOMEM;
- }
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
vunmap(cap_hdr_temp);
@@ -171,7 +167,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
if (!cap_info->page_bytes_remain) {
page = alloc_page(GFP_KERNEL);
if (!page) {
- pr_debug("%s: alloc_page() failed\n", __func__);
ret = -ENOMEM;
goto failed;
}
@@ -184,7 +179,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
kbuff = kmap(page);
if (!kbuff) {
- pr_debug("%s: kmap() failed\n", __func__);
ret = -ENOMEM;
goto failed;
}
@@ -193,7 +187,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
/* Copy capsule binary data from user space to kernel space buffer */
write_byte = min_t(size_t, count, cap_info->page_bytes_remain);
if (copy_from_user(kbuff, buff, write_byte)) {
- pr_debug("%s: copy_from_user() failed\n", __func__);
ret = -EFAULT;
goto fail_unmap;
}
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jan Kiszka <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:20 +0200 |
| Subject | [tip:efi/core] efi/capsule: Remove pr_debug() on ENOMEM or EFAULT |
| Message-ID | <tP3PA-5Lk-9@gated-at.bofh.it> |
| In reply to | #1656229 |
Commit-ID: 7367633f0bfd783ae5838141f3af88bba6c45eb9
Gitweb: http://git.kernel.org/tip/7367633f0bfd783ae5838141f3af88bba6c45eb9
Author: Jan Kiszka <jan.kiszka@siemens.com>
AuthorDate: Fri, 2 Jun 2017 13:51:57 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:38 +0200
efi/capsule: Remove pr_debug() on ENOMEM or EFAULT
Both cases are not worth a debug log message - the error code is telling
enough.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-4-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/capsule-loader.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 91e91f7..7b57dda 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -88,10 +88,8 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
temp_page = krealloc(cap_info->pages,
pages_needed * sizeof(void *),
GFP_KERNEL | __GFP_ZERO);
- if (!temp_page) {
- pr_debug("%s: krealloc() failed\n", __func__);
+ if (!temp_page)
return -ENOMEM;
- }
cap_info->pages = temp_page;
cap_info->header_obtained = true;
@@ -111,10 +109,8 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
cap_hdr_temp = vmap(cap_info->pages, cap_info->index,
VM_MAP, PAGE_KERNEL);
- if (!cap_hdr_temp) {
- pr_debug("%s: vmap() failed\n", __func__);
+ if (!cap_hdr_temp)
return -ENOMEM;
- }
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
vunmap(cap_hdr_temp);
@@ -171,7 +167,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
if (!cap_info->page_bytes_remain) {
page = alloc_page(GFP_KERNEL);
if (!page) {
- pr_debug("%s: alloc_page() failed\n", __func__);
ret = -ENOMEM;
goto failed;
}
@@ -184,7 +179,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
kbuff = kmap(page);
if (!kbuff) {
- pr_debug("%s: kmap() failed\n", __func__);
ret = -ENOMEM;
goto failed;
}
@@ -193,7 +187,6 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
/* Copy capsule binary data from user space to kernel space buffer */
write_byte = min_t(size_t, count, cap_info->page_bytes_remain);
if (copy_from_user(kbuff, buff, write_byte)) {
- pr_debug("%s: copy_from_user() failed\n", __func__);
ret = -EFAULT;
goto fail_unmap;
}
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 02/13] efi/capsule: Fix return code on failing kmap/vmap |
| Message-ID | <tNVhp-1Vg-43@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Jan Kiszka <jan.kiszka@siemens.com>
If kmap or vmap fail, it means we ran out of memory. There are no
user-provided addressed involved that would justify EFAULT.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/firmware/efi/capsule-loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 9ae6c116c474..91e91f7a8807 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
VM_MAP, PAGE_KERNEL);
if (!cap_hdr_temp) {
pr_debug("%s: vmap() failed\n", __func__);
- return -EFAULT;
+ return -ENOMEM;
}
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
@@ -185,7 +185,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
kbuff = kmap(page);
if (!kbuff) {
pr_debug("%s: kmap() failed\n", __func__);
- ret = -EFAULT;
+ ret = -ENOMEM;
goto failed;
}
kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jan Kiszka <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:20 +0200 |
| Subject | [tip:efi/core] efi/capsule: Fix return code on failing kmap/vmap |
| Message-ID | <tP3PB-5Lk-41@gated-at.bofh.it> |
| In reply to | #1656232 |
Commit-ID: fb153dc53f0eb8e8ad6a69f773e44c2d12daa5d0
Gitweb: http://git.kernel.org/tip/fb153dc53f0eb8e8ad6a69f773e44c2d12daa5d0
Author: Jan Kiszka <jan.kiszka@siemens.com>
AuthorDate: Fri, 2 Jun 2017 13:51:56 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:37 +0200
efi/capsule: Fix return code on failing kmap/vmap
If kmap or vmap fail, it means we ran out of memory. There are no
user-provided addressed involved that would justify EFAULT.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-3-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/capsule-loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 9ae6c11..91e91f7 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
VM_MAP, PAGE_KERNEL);
if (!cap_hdr_temp) {
pr_debug("%s: vmap() failed\n", __func__);
- return -EFAULT;
+ return -ENOMEM;
}
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
@@ -185,7 +185,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
kbuff = kmap(page);
if (!kbuff) {
pr_debug("%s: kmap() failed\n", __func__);
- ret = -EFAULT;
+ ret = -ENOMEM;
goto failed;
}
kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 10/13] efi/capsule: Add support for Quark security header |
| Message-ID | <tNVhp-1Vg-49@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Jan Kiszka <jan.kiszka@siemens.com>
The firmware for Quark X102x prepends a security header to the capsule
which is needed to support the mandatory secure boot on this processor.
The header can be detected by checking for the "_CSH" signature and -
to avoid any GUID conflict - validating its size field to contain the
expected value. Then we need to look for the EFI header right after the
security header and pass the real header to __efi_capsule_setup_info.
To be minimal invasive and maximal safe, the quirk version of
efi_capsule_identify_image is only effective on Quark processors.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Tested-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/x86/platform/efi/quirks.c | 137 +++++++++++++++++++++++++++++++++++++++++
drivers/firmware/efi/Kconfig | 9 +++
2 files changed, 146 insertions(+)
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 26615991d69c..93867ee08eac 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -15,12 +15,66 @@
#include <asm/e820/api.h>
#include <asm/efi.h>
#include <asm/uv/uv.h>
+#include <asm/cpu_device_id.h>
#define EFI_MIN_RESERVE 5120
#define EFI_DUMMY_GUID \
EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
+#define QUARK_CSH_SIGNATURE 0x5f435348 /* _CSH */
+#define QUARK_SECURITY_HEADER_SIZE 0x400
+
+/*
+ * Header prepended to the standard EFI capsule on Quark systems the are based
+ * on Intel firmware BSP.
+ * @csh_signature: Unique identifier to sanity check signed module
+ * presence ("_CSH").
+ * @version: Current version of CSH used. Should be one for Quark A0.
+ * @modulesize: Size of the entire module including the module header
+ * and payload.
+ * @security_version_number_index: Index of SVN to use for validation of signed
+ * module.
+ * @security_version_number: Used to prevent against roll back of modules.
+ * @rsvd_module_id: Currently unused for Clanton (Quark).
+ * @rsvd_module_vendor: Vendor Identifier. For Intel products value is
+ * 0x00008086.
+ * @rsvd_date: BCD representation of build date as yyyymmdd, where
+ * yyyy=4 digit year, mm=1-12, dd=1-31.
+ * @headersize: Total length of the header including including any
+ * padding optionally added by the signing tool.
+ * @hash_algo: What Hash is used in the module signing.
+ * @cryp_algo: What Crypto is used in the module signing.
+ * @keysize: Total length of the key data including including any
+ * padding optionally added by the signing tool.
+ * @signaturesize: Total length of the signature including including any
+ * padding optionally added by the signing tool.
+ * @rsvd_next_header: 32-bit pointer to the next Secure Boot Module in the
+ * chain, if there is a next header.
+ * @rsvd: Reserved, padding structure to required size.
+ *
+ * See also QuartSecurityHeader_t in
+ * Quark_EDKII_v1.2.1.1/QuarkPlatformPkg/Include/QuarkBootRom.h
+ * from https://downloadcenter.intel.com/download/23197/Intel-Quark-SoC-X1000-Board-Support-Package-BSP
+ */
+struct quark_security_header {
+ u32 csh_signature;
+ u32 version;
+ u32 modulesize;
+ u32 security_version_number_index;
+ u32 security_version_number;
+ u32 rsvd_module_id;
+ u32 rsvd_module_vendor;
+ u32 rsvd_date;
+ u32 headersize;
+ u32 hash_algo;
+ u32 cryp_algo;
+ u32 keysize;
+ u32 signaturesize;
+ u32 rsvd_next_header;
+ u32 rsvd[2];
+};
+
static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
static bool efi_no_storage_paranoia;
@@ -501,3 +555,86 @@ bool efi_poweroff_required(void)
{
return acpi_gbl_reduced_hardware || acpi_no_s5;
}
+
+#ifdef CONFIG_EFI_CAPSULE_QUIRK_QUARK_CSH
+
+static int qrk_capsule_setup_info(struct capsule_info *cap_info, void **pkbuff,
+ size_t hdr_bytes)
+{
+ struct quark_security_header *csh = *pkbuff;
+
+ /* Only process data block that is larger than the security header */
+ if (hdr_bytes < sizeof(struct quark_security_header))
+ return 0;
+
+ if (csh->csh_signature != QUARK_CSH_SIGNATURE ||
+ csh->headersize != QUARK_SECURITY_HEADER_SIZE)
+ return 1;
+
+ /* Only process data block if EFI header is included */
+ if (hdr_bytes < QUARK_SECURITY_HEADER_SIZE +
+ sizeof(efi_capsule_header_t))
+ return 0;
+
+ pr_debug("Quark security header detected\n");
+
+ if (csh->rsvd_next_header != 0) {
+ pr_err("multiple Quark security headers not supported\n");
+ return -EINVAL;
+ }
+
+ *pkbuff += csh->headersize;
+ cap_info->total_size = csh->headersize;
+
+ /*
+ * Update the first page pointer to skip over the CSH header.
+ */
+ cap_info->pages[0] += csh->headersize;
+
+ return 1;
+}
+
+#define ICPU(family, model, quirk_handler) \
+ { X86_VENDOR_INTEL, family, model, X86_FEATURE_ANY, \
+ (unsigned long)&quirk_handler }
+
+static const struct x86_cpu_id efi_capsule_quirk_ids[] = {
+ ICPU(5, 9, qrk_capsule_setup_info), /* Intel Quark X1000 */
+ { }
+};
+
+int efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
+ size_t hdr_bytes)
+{
+ int (*quirk_handler)(struct capsule_info *, void **, size_t);
+ const struct x86_cpu_id *id;
+ int ret;
+
+ if (hdr_bytes < sizeof(efi_capsule_header_t))
+ return 0;
+
+ cap_info->total_size = 0;
+
+ id = x86_match_cpu(efi_capsule_quirk_ids);
+ if (id) {
+ /*
+ * The quirk handler is supposed to return
+ * - a value > 0 if the setup should continue, after advancing
+ * kbuff as needed
+ * - 0 if not enough hdr_bytes are available yet
+ * - a negative error code otherwise
+ */
+ quirk_handler = (typeof(quirk_handler))id->driver_data;
+ ret = quirk_handler(cap_info, &kbuff, hdr_bytes);
+ if (ret <= 0)
+ return ret;
+ }
+
+ memcpy(&cap_info->header, kbuff, sizeof(cap_info->header));
+
+ cap_info->total_size += cap_info->header.imagesize;
+
+ return __efi_capsule_setup_info(cap_info);
+}
+
+#endif
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 2e78b0b96d74..394db40ed374 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -112,6 +112,15 @@ config EFI_CAPSULE_LOADER
Most users should say N.
+config EFI_CAPSULE_QUIRK_QUARK_CSH
+ boolean "Add support for Quark capsules with non-standard headers"
+ depends on X86 && !64BIT
+ select EFI_CAPSULE_LOADER
+ default y
+ help
+ Add support for processing Quark X1000 EFI capsules, whose header
+ layout deviates from the layout mandated by the UEFI specification.
+
config EFI_TEST
tristate "EFI Runtime Service Tests Support"
depends on EFI
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-06-05 18:00 +0200 |
| Subject | Re: [PATCH 10/13] efi/capsule: Add support for Quark security header |
| Message-ID | <tP2A9-4My-5@gated-at.bofh.it> |
| In reply to | #1656233 |
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > From: Jan Kiszka <jan.kiszka@siemens.com> > > The firmware for Quark X102x prepends a security header to the capsule > which is needed to support the mandatory secure boot on this processor. > The header can be detected by checking for the "_CSH" signature and - > to avoid any GUID conflict - validating its size field to contain the > expected value. Then we need to look for the EFI header right after the > security header and pass the real header to __efi_capsule_setup_info. > > To be minimal invasive and maximal safe, the quirk version of > efi_capsule_identify_image is only effective on Quark processors. So there's no efi_capsule_identify_image() function anywhere - this wants to be efi_capsule_setup_info(), right? I have edited the changelog accordingly. > +config EFI_CAPSULE_QUIRK_QUARK_CSH > + boolean "Add support for Quark capsules with non-standard headers" > + depends on X86 && !64BIT > + select EFI_CAPSULE_LOADER > + default y > + help > + Add support for processing Quark X1000 EFI capsules, whose header > + layout deviates from the layout mandated by the UEFI specification. BTW., there's no need to further put this behind a Kconfig option: the quirk seems targeted enough, and the whole point of runtime quirks is so that can be applied safely within generic kernels. Turning them off via Kconfig seems wrong. Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-05 18:10 +0200 |
| Subject | Re: [PATCH 10/13] efi/capsule: Add support for Quark security header |
| Message-ID | <tP2JP-54T-3@gated-at.bofh.it> |
| In reply to | #1657684 |
On 5 June 2017 at 15:50, Ingo Molnar <mingo@kernel.org> wrote: > > * Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > >> From: Jan Kiszka <jan.kiszka@siemens.com> >> >> The firmware for Quark X102x prepends a security header to the capsule >> which is needed to support the mandatory secure boot on this processor. >> The header can be detected by checking for the "_CSH" signature and - >> to avoid any GUID conflict - validating its size field to contain the >> expected value. Then we need to look for the EFI header right after the >> security header and pass the real header to __efi_capsule_setup_info. >> >> To be minimal invasive and maximal safe, the quirk version of >> efi_capsule_identify_image is only effective on Quark processors. > > So there's no efi_capsule_identify_image() function anywhere - this wants to be > efi_capsule_setup_info(), right? > > I have edited the changelog accordingly. > Thanks >> +config EFI_CAPSULE_QUIRK_QUARK_CSH >> + boolean "Add support for Quark capsules with non-standard headers" >> + depends on X86 && !64BIT >> + select EFI_CAPSULE_LOADER >> + default y >> + help >> + Add support for processing Quark X1000 EFI capsules, whose header >> + layout deviates from the layout mandated by the UEFI specification. > > BTW., there's no need to further put this behind a Kconfig option: the quirk seems > targeted enough, and the whole point of runtime quirks is so that can be applied > safely within generic kernels. Turning them off via Kconfig seems wrong. > Not entirely: enabling this quirk will remove the ability to select EFI_CAPSULE_LOADER as a module. So making it unconditional makes EFI_CAPSULE_LOADER builtin-only for 32-bit x86. This is necessary for the override of __weak symbols in the generic capsule code to work as expected. This was a compromise between allowing no capsule loader quirks at all, and having an elaborate framework with hooks in various places (which invariably ends up parameterizing the wrong things if you have only one real world quirk to design your framework around).
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-06-05 18:20 +0200 |
| Subject | Re: [PATCH 10/13] efi/capsule: Add support for Quark security header |
| Message-ID | <tP2Tx-59z-49@gated-at.bofh.it> |
| In reply to | #1657692 |
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > >> +config EFI_CAPSULE_QUIRK_QUARK_CSH > >> + boolean "Add support for Quark capsules with non-standard headers" > >> + depends on X86 && !64BIT > >> + select EFI_CAPSULE_LOADER > >> + default y > >> + help > >> + Add support for processing Quark X1000 EFI capsules, whose header > >> + layout deviates from the layout mandated by the UEFI specification. > > > > BTW., there's no need to further put this behind a Kconfig option: the quirk seems > > targeted enough, and the whole point of runtime quirks is so that can be applied > > safely within generic kernels. Turning them off via Kconfig seems wrong. > > > > Not entirely: enabling this quirk will remove the ability to select > EFI_CAPSULE_LOADER as a module. So making it unconditional makes > EFI_CAPSULE_LOADER builtin-only for 32-bit x86. This is necessary for > the override of __weak symbols in the generic capsule code to work as > expected. > > This was a compromise between allowing no capsule loader quirks at > all, and having an elaborate framework with hooks in various places > (which invariably ends up parameterizing the wrong things if you have > only one real world quirk to design your framework around). Ok, I see - fair enough! Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jan Kiszka <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:30 +0200 |
| Subject | [tip:efi/core] efi/capsule: Add support for Quark security header |
| Message-ID | <tP3Zh-5PM-35@gated-at.bofh.it> |
| In reply to | #1656233 |
Commit-ID: 2959c95d510cc45b246ba727eb8fdf8b601c6eec
Gitweb: http://git.kernel.org/tip/2959c95d510cc45b246ba727eb8fdf8b601c6eec
Author: Jan Kiszka <jan.kiszka@siemens.com>
AuthorDate: Fri, 2 Jun 2017 13:52:04 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:42 +0200
efi/capsule: Add support for Quark security header
The firmware for Quark X102x prepends a security header to the capsule
which is needed to support the mandatory secure boot on this processor.
The header can be detected by checking for the "_CSH" signature and -
to avoid any GUID conflict - validating its size field to contain the
expected value. Then we need to look for the EFI header right after the
security header and pass the real header to __efi_capsule_setup_info.
To be minimal invasive and maximal safe, the quirk version of
efi_capsule_setup_info() is only effective on Quark processors.
Tested-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-11-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/platform/efi/quirks.c | 137 +++++++++++++++++++++++++++++++++++++++++
drivers/firmware/efi/Kconfig | 9 +++
2 files changed, 146 insertions(+)
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index e0cf95a..8a99a2e 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -15,12 +15,66 @@
#include <asm/e820/api.h>
#include <asm/efi.h>
#include <asm/uv/uv.h>
+#include <asm/cpu_device_id.h>
#define EFI_MIN_RESERVE 5120
#define EFI_DUMMY_GUID \
EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
+#define QUARK_CSH_SIGNATURE 0x5f435348 /* _CSH */
+#define QUARK_SECURITY_HEADER_SIZE 0x400
+
+/*
+ * Header prepended to the standard EFI capsule on Quark systems the are based
+ * on Intel firmware BSP.
+ * @csh_signature: Unique identifier to sanity check signed module
+ * presence ("_CSH").
+ * @version: Current version of CSH used. Should be one for Quark A0.
+ * @modulesize: Size of the entire module including the module header
+ * and payload.
+ * @security_version_number_index: Index of SVN to use for validation of signed
+ * module.
+ * @security_version_number: Used to prevent against roll back of modules.
+ * @rsvd_module_id: Currently unused for Clanton (Quark).
+ * @rsvd_module_vendor: Vendor Identifier. For Intel products value is
+ * 0x00008086.
+ * @rsvd_date: BCD representation of build date as yyyymmdd, where
+ * yyyy=4 digit year, mm=1-12, dd=1-31.
+ * @headersize: Total length of the header including including any
+ * padding optionally added by the signing tool.
+ * @hash_algo: What Hash is used in the module signing.
+ * @cryp_algo: What Crypto is used in the module signing.
+ * @keysize: Total length of the key data including including any
+ * padding optionally added by the signing tool.
+ * @signaturesize: Total length of the signature including including any
+ * padding optionally added by the signing tool.
+ * @rsvd_next_header: 32-bit pointer to the next Secure Boot Module in the
+ * chain, if there is a next header.
+ * @rsvd: Reserved, padding structure to required size.
+ *
+ * See also QuartSecurityHeader_t in
+ * Quark_EDKII_v1.2.1.1/QuarkPlatformPkg/Include/QuarkBootRom.h
+ * from https://downloadcenter.intel.com/download/23197/Intel-Quark-SoC-X1000-Board-Support-Package-BSP
+ */
+struct quark_security_header {
+ u32 csh_signature;
+ u32 version;
+ u32 modulesize;
+ u32 security_version_number_index;
+ u32 security_version_number;
+ u32 rsvd_module_id;
+ u32 rsvd_module_vendor;
+ u32 rsvd_date;
+ u32 headersize;
+ u32 hash_algo;
+ u32 cryp_algo;
+ u32 keysize;
+ u32 signaturesize;
+ u32 rsvd_next_header;
+ u32 rsvd[2];
+};
+
static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
static bool efi_no_storage_paranoia;
@@ -504,3 +558,86 @@ bool efi_poweroff_required(void)
{
return acpi_gbl_reduced_hardware || acpi_no_s5;
}
+
+#ifdef CONFIG_EFI_CAPSULE_QUIRK_QUARK_CSH
+
+static int qrk_capsule_setup_info(struct capsule_info *cap_info, void **pkbuff,
+ size_t hdr_bytes)
+{
+ struct quark_security_header *csh = *pkbuff;
+
+ /* Only process data block that is larger than the security header */
+ if (hdr_bytes < sizeof(struct quark_security_header))
+ return 0;
+
+ if (csh->csh_signature != QUARK_CSH_SIGNATURE ||
+ csh->headersize != QUARK_SECURITY_HEADER_SIZE)
+ return 1;
+
+ /* Only process data block if EFI header is included */
+ if (hdr_bytes < QUARK_SECURITY_HEADER_SIZE +
+ sizeof(efi_capsule_header_t))
+ return 0;
+
+ pr_debug("Quark security header detected\n");
+
+ if (csh->rsvd_next_header != 0) {
+ pr_err("multiple Quark security headers not supported\n");
+ return -EINVAL;
+ }
+
+ *pkbuff += csh->headersize;
+ cap_info->total_size = csh->headersize;
+
+ /*
+ * Update the first page pointer to skip over the CSH header.
+ */
+ cap_info->pages[0] += csh->headersize;
+
+ return 1;
+}
+
+#define ICPU(family, model, quirk_handler) \
+ { X86_VENDOR_INTEL, family, model, X86_FEATURE_ANY, \
+ (unsigned long)&quirk_handler }
+
+static const struct x86_cpu_id efi_capsule_quirk_ids[] = {
+ ICPU(5, 9, qrk_capsule_setup_info), /* Intel Quark X1000 */
+ { }
+};
+
+int efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
+ size_t hdr_bytes)
+{
+ int (*quirk_handler)(struct capsule_info *, void **, size_t);
+ const struct x86_cpu_id *id;
+ int ret;
+
+ if (hdr_bytes < sizeof(efi_capsule_header_t))
+ return 0;
+
+ cap_info->total_size = 0;
+
+ id = x86_match_cpu(efi_capsule_quirk_ids);
+ if (id) {
+ /*
+ * The quirk handler is supposed to return
+ * - a value > 0 if the setup should continue, after advancing
+ * kbuff as needed
+ * - 0 if not enough hdr_bytes are available yet
+ * - a negative error code otherwise
+ */
+ quirk_handler = (typeof(quirk_handler))id->driver_data;
+ ret = quirk_handler(cap_info, &kbuff, hdr_bytes);
+ if (ret <= 0)
+ return ret;
+ }
+
+ memcpy(&cap_info->header, kbuff, sizeof(cap_info->header));
+
+ cap_info->total_size += cap_info->header.imagesize;
+
+ return __efi_capsule_setup_info(cap_info);
+}
+
+#endif
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 2e78b0b..394db40 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -112,6 +112,15 @@ config EFI_CAPSULE_LOADER
Most users should say N.
+config EFI_CAPSULE_QUIRK_QUARK_CSH
+ boolean "Add support for Quark capsules with non-standard headers"
+ depends on X86 && !64BIT
+ select EFI_CAPSULE_LOADER
+ default y
+ help
+ Add support for processing Quark X1000 EFI capsules, whose header
+ layout deviates from the layout mandated by the UEFI specification.
+
config EFI_TEST
tristate "EFI Runtime Service Tests Support"
depends on EFI
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore |
| Message-ID | <tNVhp-1Vg-51@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Andy Lutomirski <luto@kernel.org>
efi_call_phys_prolog() used to return a "pgd_t *" that meant one of
three different things depending on kernel and system configuration.
Clean it up so it uses a union and is more explicit about what's
going on.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/x86/include/asm/efi.h | 17 +++++++++++++++--
arch/x86/platform/efi/efi.c | 6 +++---
arch/x86/platform/efi/efi_32.c | 12 ++++++------
arch/x86/platform/efi/efi_64.c | 22 ++++++++++++----------
4 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 2f77bcefe6b4..6d74cc3802e6 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -111,11 +111,24 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
#endif /* CONFIG_X86_32 */
+union efi_saved_pgd {
+ /*
+ * If !EFI_OLD_MEMMAP or we're 32-bit, this is a verbatim saved CR3
+ * value.
+ */
+ unsigned long cr3;
+
+#ifdef CONFIG_X86_64
+ /* If EFI_OLD_MEMMAP, this is a kmalloced copy of the pgd. */
+ pgd_t *pgd;
+#endif
+};
+
extern struct efi_scratch efi_scratch;
extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);
extern int __init efi_memblock_x86_reserve_range(void);
-extern pgd_t * __init efi_call_phys_prolog(void);
-extern void __init efi_call_phys_epilog(pgd_t *save_pgd);
+extern union efi_saved_pgd __init efi_call_phys_prolog(void);
+extern void __init efi_call_phys_epilog(union efi_saved_pgd saved_pgd);
extern void __init efi_print_memmap(void);
extern void __init efi_memory_uc(u64 addr, unsigned long size);
extern void __init efi_map_region(efi_memory_desc_t *md);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 7e76a4d8304b..dc2da5e2c7e4 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -82,9 +82,9 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
{
efi_status_t status;
unsigned long flags;
- pgd_t *save_pgd;
+ union efi_saved_pgd saved_pgd;
- save_pgd = efi_call_phys_prolog();
+ saved_pgd = efi_call_phys_prolog();
/* Disable interrupts around EFI calls: */
local_irq_save(flags);
@@ -93,7 +93,7 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
descriptor_version, virtual_map);
local_irq_restore(flags);
- efi_call_phys_epilog(save_pgd);
+ efi_call_phys_epilog(saved_pgd);
return status;
}
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 3481268da3d0..403a987d06c7 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -58,13 +58,13 @@ void __init efi_map_region(efi_memory_desc_t *md)
void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
-pgd_t * __init efi_call_phys_prolog(void)
+union efi_saved_pgd __init efi_call_phys_prolog(void)
{
struct desc_ptr gdt_descr;
- pgd_t *save_pgd;
+ union efi_saved_pgd saved_pgd;
/* Current pgd is swapper_pg_dir, we'll restore it later: */
- save_pgd = swapper_pg_dir;
+ saved_pgd.cr3 = __pa(swapper_pg_dir);
load_cr3(initial_page_table);
__flush_tlb_all();
@@ -72,10 +72,10 @@ pgd_t * __init efi_call_phys_prolog(void)
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
- return save_pgd;
+ return saved_pgd;
}
-void __init efi_call_phys_epilog(pgd_t *save_pgd)
+void __init efi_call_phys_epilog(union efi_saved_pgd saved_pgd)
{
struct desc_ptr gdt_descr;
@@ -83,7 +83,7 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
- load_cr3(save_pgd);
+ write_cr3(saved_pgd.cr3);
__flush_tlb_all();
}
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index c488625c9712..6fbf6c47e603 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -69,16 +69,16 @@ static void __init early_code_mapping_set_exec(int executable)
}
}
-pgd_t * __init efi_call_phys_prolog(void)
+union efi_saved_pgd __init efi_call_phys_prolog(void)
{
unsigned long vaddress;
- pgd_t *save_pgd;
+ union efi_saved_pgd saved_pgd;
int pgd;
int n_pgds;
if (!efi_enabled(EFI_OLD_MEMMAP)) {
- save_pgd = (pgd_t *)read_cr3();
+ saved_pgd.cr3 = read_cr3();
write_cr3((unsigned long)efi_scratch.efi_pgt);
goto out;
}
@@ -86,20 +86,21 @@ pgd_t * __init efi_call_phys_prolog(void)
early_code_mapping_set_exec(1);
n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
- save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
+ saved_pgd.pgd = kmalloc_array(n_pgds, sizeof(*saved_pgd.pgd),
+ GFP_KERNEL);
for (pgd = 0; pgd < n_pgds; pgd++) {
- save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
+ saved_pgd.pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
}
out:
__flush_tlb_all();
- return save_pgd;
+ return saved_pgd;
}
-void __init efi_call_phys_epilog(pgd_t *save_pgd)
+void __init efi_call_phys_epilog(union efi_saved_pgd saved_pgd)
{
/*
* After the lock is released, the original page table is restored.
@@ -108,7 +109,7 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
int nr_pgds;
if (!efi_enabled(EFI_OLD_MEMMAP)) {
- write_cr3((unsigned long)save_pgd);
+ write_cr3(saved_pgd.cr3);
__flush_tlb_all();
return;
}
@@ -116,9 +117,10 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)
- set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);
+ set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE),
+ saved_pgd.pgd[pgd_idx]);
- kfree(save_pgd);
+ kfree(saved_pgd.pgd);
__flush_tlb_all();
early_code_mapping_set_exec(0);
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-06-05 17:50 +0200 |
| Subject | Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore |
| Message-ID | <tP2qt-4Jd-3@gated-at.bofh.it> |
| In reply to | #1656234 |
* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > From: Andy Lutomirski <luto@kernel.org> > > efi_call_phys_prolog() used to return a "pgd_t *" that meant one of > three different things depending on kernel and system configuration. > Clean it up so it uses a union and is more explicit about what's > going on. > > Signed-off-by: Andy Lutomirski <luto@kernel.org> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Andy Lutomirski <luto@amacapital.net> > Cc: Ingo Molnar <mingo@kernel.org> > Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > arch/x86/include/asm/efi.h | 17 +++++++++++++++-- > arch/x86/platform/efi/efi.c | 6 +++--- > arch/x86/platform/efi/efi_32.c | 12 ++++++------ > arch/x86/platform/efi/efi_64.c | 22 ++++++++++++---------- > 4 files changed, 36 insertions(+), 21 deletions(-) Hm, this patch does not apply cleanly to v4.12-rc4: Applying patch patches/x86efi_Clean_up_efi_CR3_saverestore-1.patch patching file arch/x86/include/asm/efi.h patching file arch/x86/platform/efi/efi.c patching file arch/x86/platform/efi/efi_32.c patching file arch/x86/platform/efi/efi_64.c Hunk #1 FAILED at 69. Hunk #2 FAILED at 86. Hunk #3 succeeded at 152 with fuzz 1 (offset 44 lines). Hunk #4 FAILED at 116. 3 out of 4 hunks FAILED -- rejects in file arch/x86/platform/efi/efi_64.c what tree is this against? Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-05 18:10 +0200 |
| Subject | Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore |
| Message-ID | <tP2JP-54T-11@gated-at.bofh.it> |
| In reply to | #1657680 |
On 5 June 2017 at 15:40, Ingo Molnar <mingo@kernel.org> wrote: > > * Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > >> From: Andy Lutomirski <luto@kernel.org> >> >> efi_call_phys_prolog() used to return a "pgd_t *" that meant one of >> three different things depending on kernel and system configuration. >> Clean it up so it uses a union and is more explicit about what's >> going on. >> >> Signed-off-by: Andy Lutomirski <luto@kernel.org> >> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> Cc: Borislav Petkov <bp@alien8.de> >> Cc: Andy Lutomirski <luto@amacapital.net> >> Cc: Ingo Molnar <mingo@kernel.org> >> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> --- >> arch/x86/include/asm/efi.h | 17 +++++++++++++++-- >> arch/x86/platform/efi/efi.c | 6 +++--- >> arch/x86/platform/efi/efi_32.c | 12 ++++++------ >> arch/x86/platform/efi/efi_64.c | 22 ++++++++++++---------- >> 4 files changed, 36 insertions(+), 21 deletions(-) > > Hm, this patch does not apply cleanly to v4.12-rc4: > > Applying patch patches/x86efi_Clean_up_efi_CR3_saverestore-1.patch > patching file arch/x86/include/asm/efi.h > patching file arch/x86/platform/efi/efi.c > patching file arch/x86/platform/efi/efi_32.c > patching file arch/x86/platform/efi/efi_64.c > Hunk #1 FAILED at 69. > Hunk #2 FAILED at 86. > Hunk #3 succeeded at 152 with fuzz 1 (offset 44 lines). > Hunk #4 FAILED at 116. > 3 out of 4 hunks FAILED -- rejects in file arch/x86/platform/efi/efi_64.c > > what tree is this against? > This is against v4.12-rc3, which lacked the EFI fix Matt sent out in the mean time. Feel free to drop it for now, and we can requeue it later if Andy is willing to rebase it. Thanks, Ard.
[toc] | [prev] | [next] | [standalone]
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Date | 2017-06-05 18:20 +0200 |
| Subject | Re: [PATCH 01/13] x86/efi: Clean up efi CR3 save/restore |
| Message-ID | <tP2Tw-59z-7@gated-at.bofh.it> |
| In reply to | #1657696 |
On Mon, Jun 5, 2017 at 9:03 AM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > On 5 June 2017 at 15:40, Ingo Molnar <mingo@kernel.org> wrote: >> >> * Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: >> >>> From: Andy Lutomirski <luto@kernel.org> >>> >>> efi_call_phys_prolog() used to return a "pgd_t *" that meant one of >>> three different things depending on kernel and system configuration. >>> Clean it up so it uses a union and is more explicit about what's >>> going on. >>> >>> Signed-off-by: Andy Lutomirski <luto@kernel.org> >>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> >>> Cc: Borislav Petkov <bp@alien8.de> >>> Cc: Andy Lutomirski <luto@amacapital.net> >>> Cc: Ingo Molnar <mingo@kernel.org> >>> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> >>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> >>> --- >>> arch/x86/include/asm/efi.h | 17 +++++++++++++++-- >>> arch/x86/platform/efi/efi.c | 6 +++--- >>> arch/x86/platform/efi/efi_32.c | 12 ++++++------ >>> arch/x86/platform/efi/efi_64.c | 22 ++++++++++++---------- >>> 4 files changed, 36 insertions(+), 21 deletions(-) >> >> Hm, this patch does not apply cleanly to v4.12-rc4: >> >> Applying patch patches/x86efi_Clean_up_efi_CR3_saverestore-1.patch >> patching file arch/x86/include/asm/efi.h >> patching file arch/x86/platform/efi/efi.c >> patching file arch/x86/platform/efi/efi_32.c >> patching file arch/x86/platform/efi/efi_64.c >> Hunk #1 FAILED at 69. >> Hunk #2 FAILED at 86. >> Hunk #3 succeeded at 152 with fuzz 1 (offset 44 lines). >> Hunk #4 FAILED at 116. >> 3 out of 4 hunks FAILED -- rejects in file arch/x86/platform/efi/efi_64.c >> >> what tree is this against? >> > > This is against v4.12-rc3, which lacked the EFI fix Matt sent out in > the mean time. > > Feel free to drop it for now, and we can requeue it later if Andy is > willing to rebase it. I had hoped this would make it into 4.12-rc1 so I could base PCID on top of it. I'll probably resend it once PCID lands and base it on PCID instead. (It's a trivial one-line conflict, but still...) --Andy
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2017-06-02 16:00 +0200 |
| Subject | [PATCH 04/13] efi/capsule: Clean up pr_err/info messages |
| Message-ID | <tNVhq-1Vg-53@gated-at.bofh.it> |
| In reply to | #1656225 |
From: Jan Kiszka <jan.kiszka@siemens.com>
Avoid __func__, improve the information provided by some of the
messages.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/firmware/efi/capsule-loader.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 7b57dda2417d..3fb91e1597a9 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -70,7 +70,7 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
pages_needed = ALIGN(cap_hdr->imagesize, PAGE_SIZE) >> PAGE_SHIFT;
if (pages_needed == 0) {
- pr_err("%s: pages count invalid\n", __func__);
+ pr_err("invalid capsule size");
return -EINVAL;
}
@@ -79,8 +79,7 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
cap_hdr->imagesize,
&cap_info->reset_type);
if (ret) {
- pr_err("%s: efi_capsule_supported() failed\n",
- __func__);
+ pr_err("capsule not supported\n");
return ret;
}
@@ -115,14 +114,14 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
vunmap(cap_hdr_temp);
if (ret) {
- pr_err("%s: efi_capsule_update() failed\n", __func__);
+ pr_err("capsule update failed\n");
return ret;
}
/* Indicate capsule binary uploading is done */
cap_info->index = NO_FURTHER_WRITE_ACTION;
- pr_info("%s: Successfully upload capsule file with reboot type '%s'\n",
- __func__, !cap_info->reset_type ? "RESET_COLD" :
+ pr_info("Successfully upload capsule file with reboot type '%s'\n",
+ !cap_info->reset_type ? "RESET_COLD" :
cap_info->reset_type == 1 ? "RESET_WARM" :
"RESET_SHUTDOWN");
return 0;
@@ -207,8 +206,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
if (cap_info->header_obtained &&
cap_info->count >= cap_info->total_size) {
if (cap_info->count > cap_info->total_size) {
- pr_err("%s: upload size exceeded header defined size\n",
- __func__);
+ pr_err("capsule upload size exceeded header defined size\n");
ret = -EINVAL;
goto failed;
}
@@ -242,7 +240,7 @@ static int efi_capsule_flush(struct file *file, fl_owner_t id)
struct capsule_info *cap_info = file->private_data;
if (cap_info->index > 0) {
- pr_err("%s: capsule upload not complete\n", __func__);
+ pr_err("capsule upload not complete\n");
efi_free_all_buff_pages(cap_info);
ret = -ECANCELED;
}
@@ -321,8 +319,7 @@ static int __init efi_capsule_loader_init(void)
ret = misc_register(&efi_capsule_misc);
if (ret)
- pr_err("%s: Failed to register misc char file note\n",
- __func__);
+ pr_err("Unable to register capsule loader device\n");
return ret;
}
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Jan Kiszka <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-05 19:20 +0200 |
| Subject | [tip:efi/core] efi/capsule: Clean up pr_err/_info() messages |
| Message-ID | <tP3PB-5Lk-51@gated-at.bofh.it> |
| In reply to | #1656235 |
Commit-ID: 5dce14b9d1a29cf76331f0fe8eb7efd63e0fcb9a
Gitweb: http://git.kernel.org/tip/5dce14b9d1a29cf76331f0fe8eb7efd63e0fcb9a
Author: Jan Kiszka <jan.kiszka@siemens.com>
AuthorDate: Fri, 2 Jun 2017 13:51:58 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 17:50:39 +0200
efi/capsule: Clean up pr_err/_info() messages
Avoid __func__, improve the information provided by some of the
messages.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-5-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/firmware/efi/capsule-loader.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c
index 7b57dda..3fb91e1 100644
--- a/drivers/firmware/efi/capsule-loader.c
+++ b/drivers/firmware/efi/capsule-loader.c
@@ -70,7 +70,7 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
pages_needed = ALIGN(cap_hdr->imagesize, PAGE_SIZE) >> PAGE_SHIFT;
if (pages_needed == 0) {
- pr_err("%s: pages count invalid\n", __func__);
+ pr_err("invalid capsule size");
return -EINVAL;
}
@@ -79,8 +79,7 @@ static ssize_t efi_capsule_setup_info(struct capsule_info *cap_info,
cap_hdr->imagesize,
&cap_info->reset_type);
if (ret) {
- pr_err("%s: efi_capsule_supported() failed\n",
- __func__);
+ pr_err("capsule not supported\n");
return ret;
}
@@ -115,14 +114,14 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
vunmap(cap_hdr_temp);
if (ret) {
- pr_err("%s: efi_capsule_update() failed\n", __func__);
+ pr_err("capsule update failed\n");
return ret;
}
/* Indicate capsule binary uploading is done */
cap_info->index = NO_FURTHER_WRITE_ACTION;
- pr_info("%s: Successfully upload capsule file with reboot type '%s'\n",
- __func__, !cap_info->reset_type ? "RESET_COLD" :
+ pr_info("Successfully upload capsule file with reboot type '%s'\n",
+ !cap_info->reset_type ? "RESET_COLD" :
cap_info->reset_type == 1 ? "RESET_WARM" :
"RESET_SHUTDOWN");
return 0;
@@ -207,8 +206,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
if (cap_info->header_obtained &&
cap_info->count >= cap_info->total_size) {
if (cap_info->count > cap_info->total_size) {
- pr_err("%s: upload size exceeded header defined size\n",
- __func__);
+ pr_err("capsule upload size exceeded header defined size\n");
ret = -EINVAL;
goto failed;
}
@@ -242,7 +240,7 @@ static int efi_capsule_flush(struct file *file, fl_owner_t id)
struct capsule_info *cap_info = file->private_data;
if (cap_info->index > 0) {
- pr_err("%s: capsule upload not complete\n", __func__);
+ pr_err("capsule upload not complete\n");
efi_free_all_buff_pages(cap_info);
ret = -ECANCELED;
}
@@ -321,8 +319,7 @@ static int __init efi_capsule_loader_init(void)
ret = misc_register(&efi_capsule_misc);
if (ret)
- pr_err("%s: Failed to register misc char file note\n",
- __func__);
+ pr_err("Unable to register capsule loader device\n");
return ret;
}
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web