]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Aug 2019 16:31:14 +0000 (09:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Aug 2019 16:31:14 +0000 (09:31 -0700)
added patches:
arm64-ftrace-ensure-module-ftrace-trampoline-is-coherent-with-i-side.patch
dm-disable-discard-if-the-underlying-storage-no-longer-supports-it.patch
drm-i915-cfl-add-a-new-cfl-pci-id.patch
netfilter-conntrack-use-consistent-ct-id-hash-calculation.patch

queue-4.19/arm64-ftrace-ensure-module-ftrace-trampoline-is-coherent-with-i-side.patch [new file with mode: 0644]
queue-4.19/dm-disable-discard-if-the-underlying-storage-no-longer-supports-it.patch [new file with mode: 0644]
queue-4.19/drm-i915-cfl-add-a-new-cfl-pci-id.patch [new file with mode: 0644]
queue-4.19/netfilter-conntrack-use-consistent-ct-id-hash-calculation.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/arm64-ftrace-ensure-module-ftrace-trampoline-is-coherent-with-i-side.patch b/queue-4.19/arm64-ftrace-ensure-module-ftrace-trampoline-is-coherent-with-i-side.patch
new file mode 100644 (file)
index 0000000..c7b1fdc
--- /dev/null
@@ -0,0 +1,80 @@
+From b6143d10d23ebb4a77af311e8b8b7f019d0163e6 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will@kernel.org>
+Date: Fri, 16 Aug 2019 14:57:43 +0100
+Subject: arm64: ftrace: Ensure module ftrace trampoline is coherent with I-side
+
+From: Will Deacon <will@kernel.org>
+
+commit b6143d10d23ebb4a77af311e8b8b7f019d0163e6 upstream.
+
+The initial support for dynamic ftrace trampolines in modules made use
+of an indirect branch which loaded its target from the beginning of
+a special section (e71a4e1bebaf7 ("arm64: ftrace: add support for far
+branches to dynamic ftrace")). Since no instructions were being patched,
+no cache maintenance was needed. However, later in be0f272bfc83 ("arm64:
+ftrace: emit ftrace-mod.o contents through code") this code was reworked
+to output the trampoline instructions directly into the PLT entry but,
+unfortunately, the necessary cache maintenance was overlooked.
+
+Add a call to __flush_icache_range() after writing the new trampoline
+instructions but before patching in the branch to the trampoline.
+
+Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: James Morse <james.morse@arm.com>
+Cc: <stable@vger.kernel.org>
+Fixes: be0f272bfc83 ("arm64: ftrace: emit ftrace-mod.o contents through code")
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/ftrace.c |   21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+--- a/arch/arm64/kernel/ftrace.c
++++ b/arch/arm64/kernel/ftrace.c
+@@ -76,7 +76,7 @@ int ftrace_make_call(struct dyn_ftrace *
+       if (offset < -SZ_128M || offset >= SZ_128M) {
+ #ifdef CONFIG_ARM64_MODULE_PLTS
+-              struct plt_entry trampoline;
++              struct plt_entry trampoline, *dst;
+               struct module *mod;
+               /*
+@@ -104,24 +104,27 @@ int ftrace_make_call(struct dyn_ftrace *
+                * is added in the future, but for now, the pr_err() below
+                * deals with a theoretical issue only.
+                */
++              dst = mod->arch.ftrace_trampoline;
+               trampoline = get_plt_entry(addr);
+-              if (!plt_entries_equal(mod->arch.ftrace_trampoline,
+-                                     &trampoline)) {
+-                      if (!plt_entries_equal(mod->arch.ftrace_trampoline,
+-                                             &(struct plt_entry){})) {
++              if (!plt_entries_equal(dst, &trampoline)) {
++                      if (!plt_entries_equal(dst, &(struct plt_entry){})) {
+                               pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n");
+                               return -EINVAL;
+                       }
+                       /* point the trampoline to our ftrace entry point */
+                       module_disable_ro(mod);
+-                      *mod->arch.ftrace_trampoline = trampoline;
++                      *dst = trampoline;
+                       module_enable_ro(mod, true);
+-                      /* update trampoline before patching in the branch */
+-                      smp_wmb();
++                      /*
++                       * Ensure updated trampoline is visible to instruction
++                       * fetch before we patch in the branch.
++                       */
++                      __flush_icache_range((unsigned long)&dst[0],
++                                           (unsigned long)&dst[1]);
+               }
+-              addr = (unsigned long)(void *)mod->arch.ftrace_trampoline;
++              addr = (unsigned long)dst;
+ #else /* CONFIG_ARM64_MODULE_PLTS */
+               return -EINVAL;
+ #endif /* CONFIG_ARM64_MODULE_PLTS */
diff --git a/queue-4.19/dm-disable-discard-if-the-underlying-storage-no-longer-supports-it.patch b/queue-4.19/dm-disable-discard-if-the-underlying-storage-no-longer-supports-it.patch
new file mode 100644 (file)
index 0000000..8308576
--- /dev/null
@@ -0,0 +1,123 @@
+From bcb44433bba5eaff293888ef22ffa07f1f0347d6 Mon Sep 17 00:00:00 2001
+From: Mike Snitzer <snitzer@redhat.com>
+Date: Wed, 3 Apr 2019 12:23:11 -0400
+Subject: dm: disable DISCARD if the underlying storage no longer supports it
+
+From: Mike Snitzer <snitzer@redhat.com>
+
+commit bcb44433bba5eaff293888ef22ffa07f1f0347d6 upstream.
+
+Storage devices which report supporting discard commands like
+WRITE_SAME_16 with unmap, but reject discard commands sent to the
+storage device.  This is a clear storage firmware bug but it doesn't
+change the fact that should a program cause discards to be sent to a
+multipath device layered on this buggy storage, all paths can end up
+failed at the same time from the discards, causing possible I/O loss.
+
+The first discard to a path will fail with Illegal Request, Invalid
+field in cdb, e.g.:
+ kernel: sd 8:0:8:19: [sdfn] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
+ kernel: sd 8:0:8:19: [sdfn] tag#0 Sense Key : Illegal Request [current]
+ kernel: sd 8:0:8:19: [sdfn] tag#0 Add. Sense: Invalid field in cdb
+ kernel: sd 8:0:8:19: [sdfn] tag#0 CDB: Write same(16) 93 08 00 00 00 00 00 a0 08 00 00 00 80 00 00 00
+ kernel: blk_update_request: critical target error, dev sdfn, sector 10487808
+
+The SCSI layer converts this to the BLK_STS_TARGET error number, the sd
+device disables its support for discard on this path, and because of the
+BLK_STS_TARGET error multipath fails the discard without failing any
+path or retrying down a different path.  But subsequent discards can
+cause path failures.  Any discards sent to the path which already failed
+a discard ends up failing with EIO from blk_cloned_rq_check_limits with
+an "over max size limit" error since the discard limit was set to 0 by
+the sd driver for the path.  As the error is EIO, this now fails the
+path and multipath tries to send the discard down the next path.  This
+cycle continues as discards are sent until all paths fail.
+
+Fix this by training DM core to disable DISCARD if the underlying
+storage already did so.
+
+Also, fix branching in dm_done() and clone_endio() to reflect the
+mutually exclussive nature of the IO operations in question.
+
+Cc: stable@vger.kernel.org
+Reported-by: David Jeffery <djeffery@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+[Salvatore Bonaccorso: backported to 4.19: Adjust for context changes in
+drivers/md/dm-core.h]
+Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/dm-core.h |    1 +
+ drivers/md/dm-rq.c   |   11 +++++++----
+ drivers/md/dm.c      |   20 ++++++++++++++++----
+ 3 files changed, 24 insertions(+), 8 deletions(-)
+
+--- a/drivers/md/dm-core.h
++++ b/drivers/md/dm-core.h
+@@ -130,6 +130,7 @@ struct mapped_device {
+ };
+ int md_in_flight(struct mapped_device *md);
++void disable_discard(struct mapped_device *md);
+ void disable_write_same(struct mapped_device *md);
+ void disable_write_zeroes(struct mapped_device *md);
+--- a/drivers/md/dm-rq.c
++++ b/drivers/md/dm-rq.c
+@@ -295,11 +295,14 @@ static void dm_done(struct request *clon
+       }
+       if (unlikely(error == BLK_STS_TARGET)) {
+-              if (req_op(clone) == REQ_OP_WRITE_SAME &&
+-                  !clone->q->limits.max_write_same_sectors)
++              if (req_op(clone) == REQ_OP_DISCARD &&
++                  !clone->q->limits.max_discard_sectors)
++                      disable_discard(tio->md);
++              else if (req_op(clone) == REQ_OP_WRITE_SAME &&
++                       !clone->q->limits.max_write_same_sectors)
+                       disable_write_same(tio->md);
+-              if (req_op(clone) == REQ_OP_WRITE_ZEROES &&
+-                  !clone->q->limits.max_write_zeroes_sectors)
++              else if (req_op(clone) == REQ_OP_WRITE_ZEROES &&
++                       !clone->q->limits.max_write_zeroes_sectors)
+                       disable_write_zeroes(tio->md);
+       }
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -910,6 +910,15 @@ static void dec_pending(struct dm_io *io
+       }
+ }
++void disable_discard(struct mapped_device *md)
++{
++      struct queue_limits *limits = dm_get_queue_limits(md);
++
++      /* device doesn't really support DISCARD, disable it */
++      limits->max_discard_sectors = 0;
++      blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue);
++}
++
+ void disable_write_same(struct mapped_device *md)
+ {
+       struct queue_limits *limits = dm_get_queue_limits(md);
+@@ -935,11 +944,14 @@ static void clone_endio(struct bio *bio)
+       dm_endio_fn endio = tio->ti->type->end_io;
+       if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {
+-              if (bio_op(bio) == REQ_OP_WRITE_SAME &&
+-                  !bio->bi_disk->queue->limits.max_write_same_sectors)
++              if (bio_op(bio) == REQ_OP_DISCARD &&
++                  !bio->bi_disk->queue->limits.max_discard_sectors)
++                      disable_discard(md);
++              else if (bio_op(bio) == REQ_OP_WRITE_SAME &&
++                       !bio->bi_disk->queue->limits.max_write_same_sectors)
+                       disable_write_same(md);
+-              if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
+-                  !bio->bi_disk->queue->limits.max_write_zeroes_sectors)
++              else if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
++                       !bio->bi_disk->queue->limits.max_write_zeroes_sectors)
+                       disable_write_zeroes(md);
+       }
diff --git a/queue-4.19/drm-i915-cfl-add-a-new-cfl-pci-id.patch b/queue-4.19/drm-i915-cfl-add-a-new-cfl-pci-id.patch
new file mode 100644 (file)
index 0000000..9e4b61a
--- /dev/null
@@ -0,0 +1,35 @@
+From d0e062ebb3a44b56a7e672da568334c76f763552 Mon Sep 17 00:00:00 2001
+From: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Date: Fri, 3 Aug 2018 16:27:21 -0700
+Subject: drm/i915/cfl: Add a new CFL PCI ID.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rodrigo Vivi <rodrigo.vivi@intel.com>
+
+commit d0e062ebb3a44b56a7e672da568334c76f763552 upstream.
+
+One more CFL ID added to spec.
+
+Cc: José Roberto de Souza <jose.souza@intel.com>
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20180803232721.20038-1-rodrigo.vivi@intel.com
+Signed-off-by: Wan Yusof, Wan Fahim AsqalaniX <wan.fahim.asqalanix.wan.yusof@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/drm/i915_pciids.h |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/drm/i915_pciids.h
++++ b/include/drm/i915_pciids.h
+@@ -386,6 +386,7 @@
+       INTEL_VGA_DEVICE(0x3E91, info), /* SRV GT2 */ \
+       INTEL_VGA_DEVICE(0x3E92, info), /* SRV GT2 */ \
+       INTEL_VGA_DEVICE(0x3E96, info), /* SRV GT2 */ \
++      INTEL_VGA_DEVICE(0x3E98, info), /* SRV GT2 */ \
+       INTEL_VGA_DEVICE(0x3E9A, info)  /* SRV GT2 */
+ /* CFL H */
diff --git a/queue-4.19/netfilter-conntrack-use-consistent-ct-id-hash-calculation.patch b/queue-4.19/netfilter-conntrack-use-consistent-ct-id-hash-calculation.patch
new file mode 100644 (file)
index 0000000..e737561
--- /dev/null
@@ -0,0 +1,65 @@
+From 656c8e9cc1badbc18eefe6ba01d33ebbcae61b9a Mon Sep 17 00:00:00 2001
+From: Dirk Morris <dmorris@metaloft.com>
+Date: Thu, 8 Aug 2019 13:57:51 -0700
+Subject: netfilter: conntrack: Use consistent ct id hash calculation
+
+From: Dirk Morris <dmorris@metaloft.com>
+
+commit 656c8e9cc1badbc18eefe6ba01d33ebbcae61b9a upstream.
+
+Change ct id hash calculation to only use invariants.
+
+Currently the ct id hash calculation is based on some fields that can
+change in the lifetime on a conntrack entry in some corner cases. The
+current hash uses the whole tuple which contains an hlist pointer which
+will change when the conntrack is placed on the dying list resulting in
+a ct id change.
+
+This patch also removes the reply-side tuple and extension pointer from
+the hash calculation so that the ct id will will not change from
+initialization until confirmation.
+
+Fixes: 3c79107631db1f7 ("netfilter: ctnetlink: don't use conntrack/expect object addresses as id")
+Signed-off-by: Dirk Morris <dmorris@metaloft.com>
+Acked-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/nf_conntrack_core.c |   16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/net/netfilter/nf_conntrack_core.c
++++ b/net/netfilter/nf_conntrack_core.c
+@@ -431,13 +431,12 @@ EXPORT_SYMBOL_GPL(nf_ct_invert_tuple);
+  * table location, we assume id gets exposed to userspace.
+  *
+  * Following nf_conn items do not change throughout lifetime
+- * of the nf_conn after it has been committed to main hash table:
++ * of the nf_conn:
+  *
+  * 1. nf_conn address
+- * 2. nf_conn->ext address
+- * 3. nf_conn->master address (normally NULL)
+- * 4. tuple
+- * 5. the associated net namespace
++ * 2. nf_conn->master address (normally NULL)
++ * 3. the associated net namespace
++ * 4. the original direction tuple
+  */
+ u32 nf_ct_get_id(const struct nf_conn *ct)
+ {
+@@ -447,9 +446,10 @@ u32 nf_ct_get_id(const struct nf_conn *c
+       net_get_random_once(&ct_id_seed, sizeof(ct_id_seed));
+       a = (unsigned long)ct;
+-      b = (unsigned long)ct->master ^ net_hash_mix(nf_ct_net(ct));
+-      c = (unsigned long)ct->ext;
+-      d = (unsigned long)siphash(&ct->tuplehash, sizeof(ct->tuplehash),
++      b = (unsigned long)ct->master;
++      c = (unsigned long)nf_ct_net(ct);
++      d = (unsigned long)siphash(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
++                                 sizeof(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple),
+                                  &ct_id_seed);
+ #ifdef CONFIG_64BIT
+       return siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &ct_id_seed);
index cdc4ab85cde64192701a6b571fe0252f754b65a0..b367d897ba0c1b207564cf6906478bb181ac45a1 100644 (file)
@@ -65,3 +65,7 @@ usb-serial-option-add-d-link-dwm-222-device-id.patch
 usb-serial-option-add-support-for-zte-mf871a.patch
 usb-serial-option-add-the-broadmobi-bm818-card.patch
 usb-serial-option-add-motorola-modem-uarts.patch
+drm-i915-cfl-add-a-new-cfl-pci-id.patch
+dm-disable-discard-if-the-underlying-storage-no-longer-supports-it.patch
+arm64-ftrace-ensure-module-ftrace-trampoline-is-coherent-with-i-side.patch
+netfilter-conntrack-use-consistent-ct-id-hash-calculation.patch