]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Mar 2017 14:03:16 +0000 (23:03 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Mar 2017 14:03:16 +0000 (23:03 +0900)
added patches:
dm-flush-queued-bios-when-process-blocks-to-avoid-deadlock.patch
ext4-don-t-bug-when-truncating-encrypted-inodes-on-the-orphan-list.patch
kvm-s390-fix-guest-migration-for-huge-guests-resulting-in-panic.patch
nfit-libnvdimm-fix-interleave-set-cookie-calculation.patch
s390-kdump-use-linux-elf-note-name-instead-of-core.patch

queue-4.4/dm-flush-queued-bios-when-process-blocks-to-avoid-deadlock.patch [new file with mode: 0644]
queue-4.4/ext4-don-t-bug-when-truncating-encrypted-inodes-on-the-orphan-list.patch [new file with mode: 0644]
queue-4.4/kvm-s390-fix-guest-migration-for-huge-guests-resulting-in-panic.patch [new file with mode: 0644]
queue-4.4/nfit-libnvdimm-fix-interleave-set-cookie-calculation.patch [new file with mode: 0644]
queue-4.4/s390-kdump-use-linux-elf-note-name-instead-of-core.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/dm-flush-queued-bios-when-process-blocks-to-avoid-deadlock.patch b/queue-4.4/dm-flush-queued-bios-when-process-blocks-to-avoid-deadlock.patch
new file mode 100644 (file)
index 0000000..bc1835a
--- /dev/null
@@ -0,0 +1,122 @@
+From d67a5f4b5947aba4bfe9a80a2b86079c215ca755 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Wed, 15 Feb 2017 11:26:10 -0500
+Subject: dm: flush queued bios when process blocks to avoid deadlock
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit d67a5f4b5947aba4bfe9a80a2b86079c215ca755 upstream.
+
+Commit df2cb6daa4 ("block: Avoid deadlocks with bio allocation by
+stacking drivers") created a workqueue for every bio set and code
+in bio_alloc_bioset() that tries to resolve some low-memory deadlocks
+by redirecting bios queued on current->bio_list to the workqueue if the
+system is low on memory.  However other deadlocks (see below **) may
+happen, without any low memory condition, because generic_make_request
+is queuing bios to current->bio_list (rather than submitting them).
+
+** the related dm-snapshot deadlock is detailed here:
+https://www.redhat.com/archives/dm-devel/2016-July/msg00065.html
+
+Fix this deadlock by redirecting any bios on current->bio_list to the
+bio_set's rescue workqueue on every schedule() call.  Consequently,
+when the process blocks on a mutex, the bios queued on
+current->bio_list are dispatched to independent workqueus and they can
+complete without waiting for the mutex to be available.
+
+The structure blk_plug contains an entry cb_list and this list can contain
+arbitrary callback functions that are called when the process blocks.
+To implement this fix DM (ab)uses the onstack plug's cb_list interface
+to get its flush_current_bio_list() called at schedule() time.
+
+This fixes the snapshot deadlock - if the map method blocks,
+flush_current_bio_list() will be called and it redirects bios waiting
+on current->bio_list to appropriate workqueues.
+
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1267650
+Depends-on: df2cb6daa4 ("block: Avoid deadlocks with bio allocation by stacking drivers")
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/dm.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 55 insertions(+)
+
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -1467,11 +1467,62 @@ void dm_accept_partial_bio(struct bio *b
+ }
+ EXPORT_SYMBOL_GPL(dm_accept_partial_bio);
++/*
++ * Flush current->bio_list when the target map method blocks.
++ * This fixes deadlocks in snapshot and possibly in other targets.
++ */
++struct dm_offload {
++      struct blk_plug plug;
++      struct blk_plug_cb cb;
++};
++
++static void flush_current_bio_list(struct blk_plug_cb *cb, bool from_schedule)
++{
++      struct dm_offload *o = container_of(cb, struct dm_offload, cb);
++      struct bio_list list;
++      struct bio *bio;
++
++      INIT_LIST_HEAD(&o->cb.list);
++
++      if (unlikely(!current->bio_list))
++              return;
++
++      list = *current->bio_list;
++      bio_list_init(current->bio_list);
++
++      while ((bio = bio_list_pop(&list))) {
++              struct bio_set *bs = bio->bi_pool;
++              if (unlikely(!bs) || bs == fs_bio_set) {
++                      bio_list_add(current->bio_list, bio);
++                      continue;
++              }
++
++              spin_lock(&bs->rescue_lock);
++              bio_list_add(&bs->rescue_list, bio);
++              queue_work(bs->rescue_workqueue, &bs->rescue_work);
++              spin_unlock(&bs->rescue_lock);
++      }
++}
++
++static void dm_offload_start(struct dm_offload *o)
++{
++      blk_start_plug(&o->plug);
++      o->cb.callback = flush_current_bio_list;
++      list_add(&o->cb.list, &current->plug->cb_list);
++}
++
++static void dm_offload_end(struct dm_offload *o)
++{
++      list_del(&o->cb.list);
++      blk_finish_plug(&o->plug);
++}
++
+ static void __map_bio(struct dm_target_io *tio)
+ {
+       int r;
+       sector_t sector;
+       struct mapped_device *md;
++      struct dm_offload o;
+       struct bio *clone = &tio->clone;
+       struct dm_target *ti = tio->ti;
+@@ -1484,7 +1535,11 @@ static void __map_bio(struct dm_target_i
+        */
+       atomic_inc(&tio->io->io_count);
+       sector = clone->bi_iter.bi_sector;
++
++      dm_offload_start(&o);
+       r = ti->type->map(ti, clone);
++      dm_offload_end(&o);
++
+       if (r == DM_MAPIO_REMAPPED) {
+               /* the bio has been remapped so dispatch it */
diff --git a/queue-4.4/ext4-don-t-bug-when-truncating-encrypted-inodes-on-the-orphan-list.patch b/queue-4.4/ext4-don-t-bug-when-truncating-encrypted-inodes-on-the-orphan-list.patch
new file mode 100644 (file)
index 0000000..985dbc5
--- /dev/null
@@ -0,0 +1,100 @@
+From 0d06863f903ac5f4f6efb0273079d27de3e53a28 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Tue, 14 Feb 2017 11:31:15 -0500
+Subject: ext4: don't BUG when truncating encrypted inodes on the orphan list
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 0d06863f903ac5f4f6efb0273079d27de3e53a28 upstream.
+
+Fix a BUG when the kernel tries to mount a file system constructed as
+follows:
+
+echo foo > foo.txt
+mke2fs -Fq -t ext4 -O encrypt foo.img 100
+debugfs -w foo.img << EOF
+write foo.txt a
+set_inode_field a i_flags 0x80800
+set_super_value s_last_orphan 12
+quit
+EOF
+
+root@kvm-xfstests:~# mount -o loop foo.img /mnt
+[  160.238770] ------------[ cut here ]------------
+[  160.240106] kernel BUG at /usr/projects/linux/ext4/fs/ext4/inode.c:3874!
+[  160.240106] invalid opcode: 0000 [#1] SMP
+[  160.240106] Modules linked in:
+[  160.240106] CPU: 0 PID: 2547 Comm: mount Tainted: G        W       4.10.0-rc3-00034-gcdd33b941b67 #227
+[  160.240106] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.1-1 04/01/2014
+[  160.240106] task: f4518000 task.stack: f47b6000
+[  160.240106] EIP: ext4_block_zero_page_range+0x1a7/0x2b4
+[  160.240106] EFLAGS: 00010246 CPU: 0
+[  160.240106] EAX: 00000001 EBX: f7be4b50 ECX: f47b7dc0 EDX: 00000007
+[  160.240106] ESI: f43b05a8 EDI: f43babec EBP: f47b7dd0 ESP: f47b7dac
+[  160.240106]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
+[  160.240106] CR0: 80050033 CR2: bfd85b08 CR3: 34a00680 CR4: 000006f0
+[  160.240106] Call Trace:
+[  160.240106]  ext4_truncate+0x1e9/0x3e5
+[  160.240106]  ext4_fill_super+0x286f/0x2b1e
+[  160.240106]  ? set_blocksize+0x2e/0x7e
+[  160.240106]  mount_bdev+0x114/0x15f
+[  160.240106]  ext4_mount+0x15/0x17
+[  160.240106]  ? ext4_calculate_overhead+0x39d/0x39d
+[  160.240106]  mount_fs+0x58/0x115
+[  160.240106]  vfs_kern_mount+0x4b/0xae
+[  160.240106]  do_mount+0x671/0x8c3
+[  160.240106]  ? _copy_from_user+0x70/0x83
+[  160.240106]  ? strndup_user+0x31/0x46
+[  160.240106]  SyS_mount+0x57/0x7b
+[  160.240106]  do_int80_syscall_32+0x4f/0x61
+[  160.240106]  entry_INT80_32+0x2f/0x2f
+[  160.240106] EIP: 0xb76b919e
+[  160.240106] EFLAGS: 00000246 CPU: 0
+[  160.240106] EAX: ffffffda EBX: 08053838 ECX: 08052188 EDX: 080537e8
+[  160.240106] ESI: c0ed0000 EDI: 00000000 EBP: 080537e8 ESP: bfa13660
+[  160.240106]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
+[  160.240106] Code: 59 8b 00 a8 01 0f 84 09 01 00 00 8b 07 66 25 00 f0 66 3d 00 80 75 61 89 f8 e8 3e e2 ff ff 84 c0 74 56 83 bf 48 02 00 00 00 75 02 <0f> 0b 81 7d e8 00 10 00 00 74 02 0f 0b 8b 43 04 8b 53 08 31 c9
+[  160.240106] EIP: ext4_block_zero_page_range+0x1a7/0x2b4 SS:ESP: 0068:f47b7dac
+[  160.317241] ---[ end trace d6a773a375c810a5 ]---
+
+The problem is that when the kernel tries to truncate an inode in
+ext4_truncate(), it tries to clear any on-disk data beyond i_size.
+Without the encryption key, it can't do that, and so it triggers a
+BUG.
+
+E2fsck does *not* provide this service, and in practice most file
+systems have their orphan list processed by e2fsck, so to avoid
+crashing, this patch skips this step if we don't have access to the
+encryption key (which is the case when processing the orphan list; in
+all other cases, we will have the encryption key, or the kernel
+wouldn't have allowed the file to be opened).
+
+An open question is whether the fact that e2fsck isn't clearing the
+bytes beyond i_size causing problems --- and if we've lived with it
+not doing it for so long, can we drop this from the kernel replay of
+the orphan list in all cases (not just when we don't have the key for
+encrypted inodes).
+
+Addresses-Google-Bug: #35209576
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -3573,6 +3573,10 @@ static int ext4_block_truncate_page(hand
+       unsigned blocksize;
+       struct inode *inode = mapping->host;
++      /* If we are processing an encrypted inode during orphan list handling */
++      if (ext4_encrypted_inode(inode) && !ext4_has_encryption_key(inode))
++              return 0;
++
+       blocksize = inode->i_sb->s_blocksize;
+       length = blocksize - (offset & (blocksize - 1));
diff --git a/queue-4.4/kvm-s390-fix-guest-migration-for-huge-guests-resulting-in-panic.patch b/queue-4.4/kvm-s390-fix-guest-migration-for-huge-guests-resulting-in-panic.patch
new file mode 100644 (file)
index 0000000..1f0e2de
--- /dev/null
@@ -0,0 +1,62 @@
+From 2e4d88009f57057df7672fa69a32b5224af54d37 Mon Sep 17 00:00:00 2001
+From: Janosch Frank <frankja@linux.vnet.ibm.com>
+Date: Thu, 2 Mar 2017 15:23:42 +0100
+Subject: KVM: s390: Fix guest migration for huge guests resulting in panic
+
+From: Janosch Frank <frankja@linux.vnet.ibm.com>
+
+commit 2e4d88009f57057df7672fa69a32b5224af54d37 upstream.
+
+While we can technically not run huge page guests right now, we can
+setup a guest with huge pages. Trying to migrate it will trigger a
+VM_BUG_ON and, if the kernel is not configured to panic on a BUG, it
+will happily try to work on non-existing page table entries.
+
+With this patch, we always return "dirty" if we encounter a large page
+when migrating. This at least fixes the immediate problem until we
+have proper handling for both kind of pages.
+
+Fixes: 15f36eb ("KVM: s390: Add proper dirty bitmap support to S390 kvm.")
+Cc: <stable@vger.kernel.org> # 3.16+
+
+Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
+Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/s390/mm/pgtable.c |   19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+--- a/arch/s390/mm/pgtable.c
++++ b/arch/s390/mm/pgtable.c
+@@ -1237,11 +1237,28 @@ EXPORT_SYMBOL_GPL(s390_reset_cmma);
+  */
+ bool gmap_test_and_clear_dirty(unsigned long address, struct gmap *gmap)
+ {
++      pgd_t *pgd;
++      pud_t *pud;
++      pmd_t *pmd;
+       pte_t *pte;
+       spinlock_t *ptl;
+       bool dirty = false;
+-      pte = get_locked_pte(gmap->mm, address, &ptl);
++      pgd = pgd_offset(gmap->mm, address);
++      pud = pud_alloc(gmap->mm, pgd, address);
++      if (!pud)
++              return false;
++      pmd = pmd_alloc(gmap->mm, pud, address);
++      if (!pmd)
++              return false;
++      /* We can't run guests backed by huge pages, but userspace can
++       * still set them up and then try to migrate them without any
++       * migration support.
++       */
++      if (pmd_large(*pmd))
++              return true;
++
++      pte = pte_alloc_map_lock(gmap->mm, pmd, address, &ptl);
+       if (unlikely(!pte))
+               return false;
diff --git a/queue-4.4/nfit-libnvdimm-fix-interleave-set-cookie-calculation.patch b/queue-4.4/nfit-libnvdimm-fix-interleave-set-cookie-calculation.patch
new file mode 100644 (file)
index 0000000..8b0f4b9
--- /dev/null
@@ -0,0 +1,178 @@
+From 86ef58a4e35e8fa66afb5898cf6dec6a3bb29f67 Mon Sep 17 00:00:00 2001
+From: Dan Williams <dan.j.williams@intel.com>
+Date: Tue, 28 Feb 2017 18:32:48 -0800
+Subject: nfit, libnvdimm: fix interleave set cookie calculation
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+commit 86ef58a4e35e8fa66afb5898cf6dec6a3bb29f67 upstream.
+
+The interleave-set cookie is a sum that sanity checks the composition of
+an interleave set has not changed from when the namespace was initially
+created.  The checksum is calculated by sorting the DIMMs by their
+location in the interleave-set. The comparison for the sort must be
+64-bit wide, not byte-by-byte as performed by memcmp() in the broken
+case.
+
+Fix the implementation to accept correct cookie values in addition to
+the Linux "memcmp" order cookies, but only allow correct cookies to be
+generated going forward. It does mean that namespaces created by
+third-party-tooling, or created by newer kernels with this fix, will not
+validate on older kernels. However, there are a couple mitigating
+conditions:
+
+    1/ platforms with namespace-label capable NVDIMMs are not widely
+       available.
+
+    2/ interleave-sets with a single-dimm are by definition not affected
+       (nothing to sort). This covers the QEMU-KVM NVDIMM emulation case.
+
+The cookie stored in the namespace label will be fixed by any write the
+namespace label, the most straightforward way to achieve this is to
+write to the "alt_name" attribute of a namespace in sysfs.
+
+Fixes: eaf961536e16 ("libnvdimm, nfit: add interleave-set state-tracking infrastructure")
+Reported-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
+Tested-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/nfit.c             |   16 +++++++++++++++-
+ drivers/nvdimm/namespace_devs.c |   28 +++++++++++++++++++++-------
+ drivers/nvdimm/nd.h             |    1 +
+ drivers/nvdimm/region_devs.c    |    9 +++++++++
+ include/linux/libnvdimm.h       |    2 ++
+ 5 files changed, 48 insertions(+), 8 deletions(-)
+
+--- a/drivers/acpi/nfit.c
++++ b/drivers/acpi/nfit.c
+@@ -965,7 +965,7 @@ static size_t sizeof_nfit_set_info(int n
+               + num_mappings * sizeof(struct nfit_set_info_map);
+ }
+-static int cmp_map(const void *m0, const void *m1)
++static int cmp_map_compat(const void *m0, const void *m1)
+ {
+       const struct nfit_set_info_map *map0 = m0;
+       const struct nfit_set_info_map *map1 = m1;
+@@ -974,6 +974,14 @@ static int cmp_map(const void *m0, const
+                       sizeof(u64));
+ }
++static int cmp_map(const void *m0, const void *m1)
++{
++      const struct nfit_set_info_map *map0 = m0;
++      const struct nfit_set_info_map *map1 = m1;
++
++      return map0->region_offset - map1->region_offset;
++}
++
+ /* Retrieve the nth entry referencing this spa */
+ static struct acpi_nfit_memory_map *memdev_from_spa(
+               struct acpi_nfit_desc *acpi_desc, u16 range_index, int n)
+@@ -1029,6 +1037,12 @@ static int acpi_nfit_init_interleave_set
+       sort(&info->mapping[0], nr, sizeof(struct nfit_set_info_map),
+                       cmp_map, NULL);
+       nd_set->cookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);
++
++      /* support namespaces created with the wrong sort order */
++      sort(&info->mapping[0], nr, sizeof(struct nfit_set_info_map),
++                      cmp_map_compat, NULL);
++      nd_set->altcookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);
++
+       ndr_desc->nd_set = nd_set;
+       devm_kfree(dev, info);
+--- a/drivers/nvdimm/namespace_devs.c
++++ b/drivers/nvdimm/namespace_devs.c
+@@ -1534,6 +1534,7 @@ static int select_pmem_id(struct nd_regi
+ static int find_pmem_label_set(struct nd_region *nd_region,
+               struct nd_namespace_pmem *nspm)
+ {
++      u64 altcookie = nd_region_interleave_set_altcookie(nd_region);
+       u64 cookie = nd_region_interleave_set_cookie(nd_region);
+       struct nd_namespace_label *nd_label;
+       u8 select_id[NSLABEL_UUID_LEN];
+@@ -1542,8 +1543,10 @@ static int find_pmem_label_set(struct nd
+       int rc = -ENODEV, l;
+       u16 i;
+-      if (cookie == 0)
++      if (cookie == 0) {
++              dev_dbg(&nd_region->dev, "invalid interleave-set-cookie\n");
+               return -ENXIO;
++      }
+       /*
+        * Find a complete set of labels by uuid.  By definition we can start
+@@ -1552,13 +1555,24 @@ static int find_pmem_label_set(struct nd
+       for_each_label(l, nd_label, nd_region->mapping[0].labels) {
+               u64 isetcookie = __le64_to_cpu(nd_label->isetcookie);
+-              if (isetcookie != cookie)
+-                      continue;
++              if (isetcookie != cookie) {
++                      dev_dbg(&nd_region->dev, "invalid cookie in label: %pUb\n",
++                                      nd_label->uuid);
++                      if (isetcookie != altcookie)
++                              continue;
++
++                      dev_dbg(&nd_region->dev, "valid altcookie in label: %pUb\n",
++                                      nd_label->uuid);
++              }
++
++              for (i = 0; nd_region->ndr_mappings; i++) {
++                      if (has_uuid_at_pos(nd_region, nd_label->uuid, cookie, i))
++                              continue;
++                      if (has_uuid_at_pos(nd_region, nd_label->uuid, altcookie, i))
++                              continue;
++                      break;
++              }
+-              for (i = 0; nd_region->ndr_mappings; i++)
+-                      if (!has_uuid_at_pos(nd_region, nd_label->uuid,
+-                                              cookie, i))
+-                              break;
+               if (i < nd_region->ndr_mappings) {
+                       /*
+                        * Give up if we don't find an instance of a
+--- a/drivers/nvdimm/nd.h
++++ b/drivers/nvdimm/nd.h
+@@ -245,6 +245,7 @@ struct nd_region *to_nd_region(struct de
+ int nd_region_to_nstype(struct nd_region *nd_region);
+ int nd_region_register_namespaces(struct nd_region *nd_region, int *err);
+ u64 nd_region_interleave_set_cookie(struct nd_region *nd_region);
++u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region);
+ void nvdimm_bus_lock(struct device *dev);
+ void nvdimm_bus_unlock(struct device *dev);
+ bool is_nvdimm_bus_locked(struct device *dev);
+--- a/drivers/nvdimm/region_devs.c
++++ b/drivers/nvdimm/region_devs.c
+@@ -379,6 +379,15 @@ u64 nd_region_interleave_set_cookie(stru
+       return 0;
+ }
++u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region)
++{
++      struct nd_interleave_set *nd_set = nd_region->nd_set;
++
++      if (nd_set)
++              return nd_set->altcookie;
++      return 0;
++}
++
+ /*
+  * Upon successful probe/remove, take/release a reference on the
+  * associated interleave set (if present), and plant new btt + namespace
+--- a/include/linux/libnvdimm.h
++++ b/include/linux/libnvdimm.h
+@@ -83,6 +83,8 @@ struct nd_cmd_desc {
+ struct nd_interleave_set {
+       u64 cookie;
++      /* compatibility with initial buggy Linux implementation */
++      u64 altcookie;
+ };
+ struct nd_region_desc {
diff --git a/queue-4.4/s390-kdump-use-linux-elf-note-name-instead-of-core.patch b/queue-4.4/s390-kdump-use-linux-elf-note-name-instead-of-core.patch
new file mode 100644 (file)
index 0000000..a1aa889
--- /dev/null
@@ -0,0 +1,112 @@
+From a4a81d8eebdc1d209d034f62a082a5131e4242b5 Mon Sep 17 00:00:00 2001
+From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
+Date: Tue, 7 Feb 2017 18:09:14 +0100
+Subject: s390/kdump: Use "LINUX" ELF note name instead of "CORE"
+
+From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
+
+commit a4a81d8eebdc1d209d034f62a082a5131e4242b5 upstream.
+
+In binutils/libbfd (bfd/elf.c) it is enforced that all s390 specific ELF
+notes like e.g. NT_S390_PREFIX or NT_S390_CTRS have "LINUX" specified
+as note name. Otherwise the notes are ignored.
+
+For /proc/vmcore we currently use "CORE" for these notes.
+
+Up to now this has not been a real problem because the dump analysis tool
+"crash" does not check the note name. But it will break all programs that
+use libbfd for processing ELF notes.
+
+So fix this and use "LINUX" for all s390 specific notes to comply with
+libbfd.
+
+Reported-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
+Reviewed-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
+Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/s390/kernel/crash_dump.c |   18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+--- a/arch/s390/kernel/crash_dump.c
++++ b/arch/s390/kernel/crash_dump.c
+@@ -23,6 +23,8 @@
+ #define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
+ #define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y))))
++#define LINUX_NOTE_NAME "LINUX"
++
+ static struct memblock_region oldmem_region;
+ static struct memblock_type oldmem_type = {
+@@ -312,7 +314,7 @@ static void *nt_fpregset(void *ptr, stru
+ static void *nt_s390_timer(void *ptr, struct save_area *sa)
+ {
+       return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer),
+-                       KEXEC_CORE_NOTE_NAME);
++                       LINUX_NOTE_NAME);
+ }
+ /*
+@@ -321,7 +323,7 @@ static void *nt_s390_timer(void *ptr, st
+ static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa)
+ {
+       return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp,
+-                     sizeof(sa->clk_cmp), KEXEC_CORE_NOTE_NAME);
++                     sizeof(sa->clk_cmp), LINUX_NOTE_NAME);
+ }
+ /*
+@@ -330,7 +332,7 @@ static void *nt_s390_tod_cmp(void *ptr,
+ static void *nt_s390_tod_preg(void *ptr, struct save_area *sa)
+ {
+       return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg,
+-                     sizeof(sa->tod_reg), KEXEC_CORE_NOTE_NAME);
++                     sizeof(sa->tod_reg), LINUX_NOTE_NAME);
+ }
+ /*
+@@ -339,7 +341,7 @@ static void *nt_s390_tod_preg(void *ptr,
+ static void *nt_s390_ctrs(void *ptr, struct save_area *sa)
+ {
+       return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs,
+-                     sizeof(sa->ctrl_regs), KEXEC_CORE_NOTE_NAME);
++                     sizeof(sa->ctrl_regs), LINUX_NOTE_NAME);
+ }
+ /*
+@@ -348,7 +350,7 @@ static void *nt_s390_ctrs(void *ptr, str
+ static void *nt_s390_prefix(void *ptr, struct save_area *sa)
+ {
+       return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg,
+-                       sizeof(sa->pref_reg), KEXEC_CORE_NOTE_NAME);
++                       sizeof(sa->pref_reg), LINUX_NOTE_NAME);
+ }
+ /*
+@@ -357,7 +359,7 @@ static void *nt_s390_prefix(void *ptr, s
+ static void *nt_s390_vx_high(void *ptr, __vector128 *vx_regs)
+ {
+       return nt_init(ptr, NT_S390_VXRS_HIGH, &vx_regs[16],
+-                     16 * sizeof(__vector128), KEXEC_CORE_NOTE_NAME);
++                     16 * sizeof(__vector128), LINUX_NOTE_NAME);
+ }
+ /*
+@@ -370,12 +372,12 @@ static void *nt_s390_vx_low(void *ptr, _
+       int i;
+       note = (Elf64_Nhdr *)ptr;
+-      note->n_namesz = strlen(KEXEC_CORE_NOTE_NAME) + 1;
++      note->n_namesz = strlen(LINUX_NOTE_NAME) + 1;
+       note->n_descsz = 16 * 8;
+       note->n_type = NT_S390_VXRS_LOW;
+       len = sizeof(Elf64_Nhdr);
+-      memcpy(ptr + len, KEXEC_CORE_NOTE_NAME, note->n_namesz);
++      memcpy(ptr + len, LINUX_NOTE_NAME, note->n_namesz);
+       len = roundup(len + note->n_namesz, 4);
+       ptr += len;
index db2faf1c03b00feecf9423694c2815769d5e8560..c1a3265c418264733625633e63332daa09e14e67 100644 (file)
@@ -28,3 +28,8 @@ usb-serial-io_ti-fix-null-deref-in-interrupt-callback.patch
 usb-serial-io_ti-fix-information-leak-in-completion-handler.patch
 serial-samsung-continue-to-work-if-dma-request-fails.patch
 mvsas-fix-misleading-indentation.patch
+kvm-s390-fix-guest-migration-for-huge-guests-resulting-in-panic.patch
+s390-kdump-use-linux-elf-note-name-instead-of-core.patch
+nfit-libnvdimm-fix-interleave-set-cookie-calculation.patch
+dm-flush-queued-bios-when-process-blocks-to-avoid-deadlock.patch
+ext4-don-t-bug-when-truncating-encrypted-inodes-on-the-orphan-list.patch