summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Leemhuis <fedora@leemhuis.info>2017-01-13 07:27:24 +0100
committerThorsten Leemhuis <fedora@leemhuis.info>2017-01-13 07:27:24 +0100
commit74164a8271ed245a7c9b1fd7071a344738c25008 (patch)
tree1212ca07494a14a42a9d8e3410fd8d6d4e45d827
parentf8c452d5fd66e71f1fe80dcce808e8246e11e830 (diff)
parentdaebcac5174fc731de75e6ab0c01805707eac3b7 (diff)
downloadkernel-4.9.3-200.vanilla.knurd.1.fc25.tar.gz
kernel-4.9.3-200.vanilla.knurd.1.fc25.tar.xz
kernel-4.9.3-200.vanilla.knurd.1.fc25.zip
Merge remote-tracking branch 'origin/f25' into f25-user-thl-vanilla-fedorakernel-4.9.3-200.vanilla.knurd.1.fc25kernel-4.9.3-200.vanilla.knurd.1.fc24
-rw-r--r--0001-efi-prune-invalid-memory-map-entries.patch141
-rw-r--r--kernel.spec16
-rw-r--r--sources2
3 files changed, 156 insertions, 3 deletions
diff --git a/0001-efi-prune-invalid-memory-map-entries.patch b/0001-efi-prune-invalid-memory-map-entries.patch
new file mode 100644
index 000000000..4b65ef504
--- /dev/null
+++ b/0001-efi-prune-invalid-memory-map-entries.patch
@@ -0,0 +1,141 @@
+From c7c7030a020405d5826c03839e38986e0f78f2ea Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Tue, 13 Dec 2016 10:25:10 +0000
+Subject: [PATCH] efi: prune invalid memory map entries
+
+Some machines, such as the Lenovo ThinkPad W541 with firmware GNET80WW
+(2.28), include memory map entries with phys_addr=0x0 and num_pages=0.
+
+Currently the log output for this case (with efi=debug) looks like:
+
+[ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0xffffffffffffffff] (0MB)
+
+This is clearly wrong, and also not as informative as it could be. This
+patch changes it so that if we find obviously invalid memory map
+entries, we print an error and those entries. It also detects the
+display of the address range calculation overflow, so the new output is:
+
+[ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries:
+[ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[0x0000000000000000-0x0000000000000000] (invalid)
+
+It also detects memory map sizes that would overflow the physical
+address, for example phys_addr=0xfffffffffffff000 and
+num_pages=0x0200000000000001, and prints:
+
+[ 0.000000] efi: [Firmware Bug]: Invalid EFI memory map entries:
+[ 0.000000] efi: mem45: [Reserved | | | | | | | | | | | | ] range=[phys_addr=0xfffffffffffff000-0x20ffffffffffffffff] (invalid)
+
+It then removes these entries from the memory map.
+
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Signed-off-by: Peter Jones <pjones@redhat.com>
+[ardb: refactor for clarity with no functional changes, avoid PAGE_SHIFT]
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+---
+ arch/x86/platform/efi/efi.c | 70 +++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/efi.h | 1 +
+ 2 files changed, 71 insertions(+)
+
+diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
+index bf99aa7..0a1550b 100644
+--- a/arch/x86/platform/efi/efi.c
++++ b/arch/x86/platform/efi/efi.c
+@@ -210,6 +210,74 @@ int __init efi_memblock_x86_reserve_range(void)
+ return 0;
+ }
+
++#define OVERFLOW_ADDR_SHIFT (64 - EFI_PAGE_SHIFT)
++#define OVERFLOW_ADDR_MASK (U64_MAX << OVERFLOW_ADDR_SHIFT)
++#define U64_HIGH_BIT (~(U64_MAX >> 1))
++
++static bool __init efi_memmap_entry_valid(const efi_memory_desc_t *md, int i)
++{
++ static __initdata bool once = true;
++ u64 end = (md->num_pages << EFI_PAGE_SHIFT) + md->phys_addr - 1;
++ u64 end_hi = 0;
++ char buf[64];
++
++ if (md->num_pages == 0) {
++ end = 0;
++ } else if (md->num_pages > EFI_PAGES_MAX ||
++ EFI_PAGES_MAX - md->num_pages <
++ (md->phys_addr >> EFI_PAGE_SHIFT)) {
++ end_hi = (md->num_pages & OVERFLOW_ADDR_MASK)
++ >> OVERFLOW_ADDR_SHIFT;
++
++ if ((md->phys_addr & U64_HIGH_BIT) && !(end & U64_HIGH_BIT))
++ end_hi += 1;
++ } else {
++ return true;
++ }
++
++ if (once) {
++ pr_warn(FW_BUG "Invalid EFI memory map entries:\n");
++ once = false;
++ }
++
++ if (end_hi) {
++ pr_warn("mem%02u: %s range=[0x%016llx-0x%llx%016llx] (invalid)\n",
++ i, efi_md_typeattr_format(buf, sizeof(buf), md),
++ md->phys_addr, end_hi, end);
++ } else {
++ pr_warn("mem%02u: %s range=[0x%016llx-0x%016llx] (invalid)\n",
++ i, efi_md_typeattr_format(buf, sizeof(buf), md),
++ md->phys_addr, end);
++ }
++ return false;
++}
++
++static void __init efi_clean_memmap(void)
++{
++ efi_memory_desc_t *out = efi.memmap.map;
++ const efi_memory_desc_t *in = out;
++ const efi_memory_desc_t *end = efi.memmap.map_end;
++ int i, n_removal;
++
++ for (i = n_removal = 0; in < end; i++) {
++ if (efi_memmap_entry_valid(in, i)) {
++ if (out != in)
++ memcpy(out, in, efi.memmap.desc_size);
++ out = (void *)out + efi.memmap.desc_size;
++ } else {
++ n_removal++;
++ }
++ in = (void *)in + efi.memmap.desc_size;
++ }
++
++ if (n_removal > 0) {
++ u64 size = efi.memmap.nr_map - n_removal;
++
++ pr_warn("Removing %d invalid memory map entries.\n", n_removal);
++ efi_memmap_install(efi.memmap.phys_map, size);
++ }
++}
++
+ void __init efi_print_memmap(void)
+ {
+ efi_memory_desc_t *md;
+@@ -472,6 +540,8 @@ void __init efi_init(void)
+ }
+ }
+
++ efi_clean_memmap();
++
+ if (efi_enabled(EFI_DBG))
+ efi_print_memmap();
+ }
+diff --git a/include/linux/efi.h b/include/linux/efi.h
+index 4c1b3ea..712a3aa 100644
+--- a/include/linux/efi.h
++++ b/include/linux/efi.h
+@@ -103,6 +103,7 @@ typedef struct {
+
+ #define EFI_PAGE_SHIFT 12
+ #define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
++#define EFI_PAGES_MAX (U64_MAX >> EFI_PAGE_SHIFT)
+
+ typedef struct {
+ u32 type;
+--
+2.9.3
+
diff --git a/kernel.spec b/kernel.spec
index 1715e4cec..212f2fc5c 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -58,7 +58,7 @@ Summary: The Linux kernel
%define stable_rc 0
# Do we have a -stable update to apply?
-%define stable_update 2
+%define stable_update 3
# Set rpm version accordingly
%if 0%{?stable_update}
%define stablerev %{stable_update}
@@ -643,8 +643,14 @@ Patch665: netfilter-x_tables-deal-with-bogus-nextoffset-values.patch
#ongoing complaint, full discussion delayed until ksummit/plumbers
Patch849: 0001-iio-Use-event-header-from-kernel-tree.patch
+# Work around thinkpad firmware memory layout issues and efi_mem_reserve()
+Patch850: 0001-efi-prune-invalid-memory-map-entries.patch
+
# Request from dwalsh
-Patch850: selinux-namespace-fix.patch
+Patch851: selinux-namespace-fix.patch
+
+#rhbz 1390308
+Patch852: nouveau-add-maxwell-to-backlight-init.patch
# END OF PATCH DEFINITIONS
@@ -2187,6 +2193,12 @@ fi
#
#
%changelog
+* Thu Jan 12 2017 Laura Abbott <labbott@fedoraproject.org> - 4.9.3-200
+- Linux v4.9.3
+
+* Wed Jan 11 2017 Laura Abbott <labbott@fedoraproject.org>
+- Add fix for some thinkpads missed during the rebase.
+
* Mon Jan 09 2017 Laura Abbott <labbott@fedoraproject.org> - 4.9.2-200
- Linux v4.9.2 rebase
diff --git a/sources b/sources
index b844112b1..2df03010c 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
SHA512 (linux-4.9.tar.xz) = bf67ff812cc3cb7e5059e82cc5db0d9a7c5637f7ed9a42e4730c715bf7047c81ed3a571225f92a33ef0b6d65f35595bc32d773356646df2627da55e9bc7f1f1a
SHA512 (perf-man-4.9.tar.gz) = d23bb3da1eadd6623fddbf4696948de7675f3dcf57c711a7427dd7ae111394f58d8f42752938bbea7cd219f1e7f6f116fc67a1c74f769711063940a065f37b99
-SHA512 (patch-4.9.2.xz) = b7033105561d9829151dd1d374baa7f3e19e2ae767dc3a7a0abcf0be7bc821346deb5748809b146847b44f910243fef50a3db32f664ff88a54c37938852bfcb6
+SHA512 (patch-4.9.3.xz) = ebda3a59a2d61759db2b49d57e7805f24423e786a0401b9e71de800038fa38d5d7740127b7d87fd0c5a8ea2ecfe7c3be2d717afe3166d97e48efa9522063dde3