]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.8-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Aug 2020 12:02:31 +0000 (14:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Aug 2020 12:02:31 +0000 (14:02 +0200)
added patches:
pci-tegra-revert-tegra124-raw_violation_fixup.patch
powerpc-kasan-fix-shadow-pages-allocation-failure.patch
revert-powerpc-kasan-fix-shadow-pages-allocation-failure.patch
xattr-break-delegations-in-set-remove-xattr.patch

queue-5.8/pci-tegra-revert-tegra124-raw_violation_fixup.patch [new file with mode: 0644]
queue-5.8/powerpc-kasan-fix-shadow-pages-allocation-failure.patch [new file with mode: 0644]
queue-5.8/revert-powerpc-kasan-fix-shadow-pages-allocation-failure.patch [new file with mode: 0644]
queue-5.8/series
queue-5.8/xattr-break-delegations-in-set-remove-xattr.patch [new file with mode: 0644]

diff --git a/queue-5.8/pci-tegra-revert-tegra124-raw_violation_fixup.patch b/queue-5.8/pci-tegra-revert-tegra124-raw_violation_fixup.patch
new file mode 100644 (file)
index 0000000..9782983
--- /dev/null
@@ -0,0 +1,159 @@
+From e7b856dfcec6d3bf028adee8c65342d7035914a1 Mon Sep 17 00:00:00 2001
+From: Nicolas Chauvet <kwizart@gmail.com>
+Date: Sat, 18 Jul 2020 12:07:10 +0200
+Subject: PCI: tegra: Revert tegra124 raw_violation_fixup
+
+From: Nicolas Chauvet <kwizart@gmail.com>
+
+commit e7b856dfcec6d3bf028adee8c65342d7035914a1 upstream.
+
+As reported in https://bugzilla.kernel.org/206217 , raw_violation_fixup
+is causing more harm than good in some common use-cases.
+
+This patch is a partial revert of commit:
+
+191cd6fb5d2c ("PCI: tegra: Add SW fixup for RAW violations")
+
+and fixes the following regression since then.
+
+* Description:
+
+When both the NIC and MMC are used one can see the following message:
+
+  NETDEV WATCHDOG: enp1s0 (r8169): transmit queue 0 timed out
+
+and
+
+  pcieport 0000:00:02.0: AER: Uncorrected (Non-Fatal) error received: 0000:01:00.0
+  r8169 0000:01:00.0: AER: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID)
+  r8169 0000:01:00.0: AER:   device [10ec:8168] error status/mask=00004000/00400000
+  r8169 0000:01:00.0: AER:    [14] CmpltTO                (First)
+  r8169 0000:01:00.0: AER: can't recover (no error_detected callback)
+  pcieport 0000:00:02.0: AER: device recovery failed
+
+After that, the ethernet NIC is not functional anymore even after
+reloading the r8169 module. After a reboot, this is reproducible by
+copying a large file over the NIC to the MMC.
+
+For some reason this is not reproducible when files are copied to a tmpfs.
+
+* Little background on the fixup, by Manikanta Maddireddy:
+  "In the internal testing with dGPU on Tegra124, CmplTO is reported by
+dGPU. This happened because FIFO queue in AFI(AXI to PCIe) module
+get full by upstream posted writes. Back to back upstream writes
+interleaved with infrequent reads, triggers RAW violation and CmpltTO.
+This is fixed by reducing the posted write credits and by changing
+updateFC timer frequency. These settings are fixed after stress test.
+
+In the current case, RTL NIC is also reporting CmplTO. These settings
+seems to be aggravating the issue instead of fixing it."
+
+Link: https://lore.kernel.org/r/20200718100710.15398-1-kwizart@gmail.com
+Fixes: 191cd6fb5d2c ("PCI: tegra: Add SW fixup for RAW violations")
+Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/controller/pci-tegra.c |   32 --------------------------------
+ 1 file changed, 32 deletions(-)
+
+--- a/drivers/pci/controller/pci-tegra.c
++++ b/drivers/pci/controller/pci-tegra.c
+@@ -181,13 +181,6 @@
+ #define AFI_PEXBIAS_CTRL_0            0x168
+-#define RP_PRIV_XP_DL         0x00000494
+-#define  RP_PRIV_XP_DL_GEN2_UPD_FC_TSHOLD     (0x1ff << 1)
+-
+-#define RP_RX_HDR_LIMIT               0x00000e00
+-#define  RP_RX_HDR_LIMIT_PW_MASK      (0xff << 8)
+-#define  RP_RX_HDR_LIMIT_PW           (0x0e << 8)
+-
+ #define RP_ECTL_2_R1  0x00000e84
+ #define  RP_ECTL_2_R1_RX_CTLE_1C_MASK         0xffff
+@@ -323,7 +316,6 @@ struct tegra_pcie_soc {
+       bool program_uphy;
+       bool update_clamp_threshold;
+       bool program_deskew_time;
+-      bool raw_violation_fixup;
+       bool update_fc_timer;
+       bool has_cache_bars;
+       struct {
+@@ -659,23 +651,6 @@ static void tegra_pcie_apply_sw_fixup(st
+               writel(value, port->base + RP_VEND_CTL0);
+       }
+-      /* Fixup for read after write violation. */
+-      if (soc->raw_violation_fixup) {
+-              value = readl(port->base + RP_RX_HDR_LIMIT);
+-              value &= ~RP_RX_HDR_LIMIT_PW_MASK;
+-              value |= RP_RX_HDR_LIMIT_PW;
+-              writel(value, port->base + RP_RX_HDR_LIMIT);
+-
+-              value = readl(port->base + RP_PRIV_XP_DL);
+-              value |= RP_PRIV_XP_DL_GEN2_UPD_FC_TSHOLD;
+-              writel(value, port->base + RP_PRIV_XP_DL);
+-
+-              value = readl(port->base + RP_VEND_XP);
+-              value &= ~RP_VEND_XP_UPDATE_FC_THRESHOLD_MASK;
+-              value |= soc->update_fc_threshold;
+-              writel(value, port->base + RP_VEND_XP);
+-      }
+-
+       if (soc->update_fc_timer) {
+               value = readl(port->base + RP_VEND_XP);
+               value &= ~RP_VEND_XP_UPDATE_FC_THRESHOLD_MASK;
+@@ -2416,7 +2391,6 @@ static const struct tegra_pcie_soc tegra
+       .program_uphy = true,
+       .update_clamp_threshold = false,
+       .program_deskew_time = false,
+-      .raw_violation_fixup = false,
+       .update_fc_timer = false,
+       .has_cache_bars = true,
+       .ectl.enable = false,
+@@ -2446,7 +2420,6 @@ static const struct tegra_pcie_soc tegra
+       .program_uphy = true,
+       .update_clamp_threshold = false,
+       .program_deskew_time = false,
+-      .raw_violation_fixup = false,
+       .update_fc_timer = false,
+       .has_cache_bars = false,
+       .ectl.enable = false,
+@@ -2459,8 +2432,6 @@ static const struct tegra_pcie_soc tegra
+       .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
+       .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
+       .pads_refclk_cfg0 = 0x44ac44ac,
+-      /* FC threshold is bit[25:18] */
+-      .update_fc_threshold = 0x03fc0000,
+       .has_pex_clkreq_en = true,
+       .has_pex_bias_ctrl = true,
+       .has_intr_prsnt_sense = true,
+@@ -2470,7 +2441,6 @@ static const struct tegra_pcie_soc tegra
+       .program_uphy = true,
+       .update_clamp_threshold = true,
+       .program_deskew_time = false,
+-      .raw_violation_fixup = true,
+       .update_fc_timer = false,
+       .has_cache_bars = false,
+       .ectl.enable = false,
+@@ -2494,7 +2464,6 @@ static const struct tegra_pcie_soc tegra
+       .program_uphy = true,
+       .update_clamp_threshold = true,
+       .program_deskew_time = true,
+-      .raw_violation_fixup = false,
+       .update_fc_timer = true,
+       .has_cache_bars = false,
+       .ectl = {
+@@ -2536,7 +2505,6 @@ static const struct tegra_pcie_soc tegra
+       .program_uphy = false,
+       .update_clamp_threshold = false,
+       .program_deskew_time = false,
+-      .raw_violation_fixup = false,
+       .update_fc_timer = false,
+       .has_cache_bars = false,
+       .ectl.enable = false,
diff --git a/queue-5.8/powerpc-kasan-fix-shadow-pages-allocation-failure.patch b/queue-5.8/powerpc-kasan-fix-shadow-pages-allocation-failure.patch
new file mode 100644 (file)
index 0000000..3a220f2
--- /dev/null
@@ -0,0 +1,75 @@
+From 41ea93cf7ba4e0f0cc46ebfdda8b6ff27c67bc91 Mon Sep 17 00:00:00 2001
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+Date: Thu, 2 Jul 2020 11:52:03 +0000
+Subject: powerpc/kasan: Fix shadow pages allocation failure
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+commit 41ea93cf7ba4e0f0cc46ebfdda8b6ff27c67bc91 upstream.
+
+Doing kasan pages allocation in MMU_init is too early, kernel doesn't
+have access yet to the entire memory space and memblock_alloc() fails
+when the kernel is a bit big.
+
+Do it from kasan_init() instead.
+
+Fixes: 2edb16efc899 ("powerpc/32: Add KASAN support")
+Fixes: d2a91cef9bbd ("powerpc/kasan: Fix shadow pages allocation failure")
+Cc: stable@vger.kernel.org
+Reported-by: Erhard F. <erhard_f@mailbox.org>
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=208181
+Link: https://lore.kernel.org/r/63048fcea8a1c02f75429ba3152f80f7853f87fc.1593690707.git.christophe.leroy@csgroup.eu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/mm/kasan/kasan_init_32.c |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/arch/powerpc/mm/kasan/kasan_init_32.c
++++ b/arch/powerpc/mm/kasan/kasan_init_32.c
+@@ -120,11 +120,24 @@ static void __init kasan_unmap_early_sha
+ void __init kasan_mmu_init(void)
+ {
+       int ret;
++
++      if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE) ||
++          IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
++              ret = kasan_init_shadow_page_tables(KASAN_SHADOW_START, KASAN_SHADOW_END);
++
++              if (ret)
++                      panic("kasan: kasan_init_shadow_page_tables() failed");
++      }
++}
++
++void __init kasan_init(void)
++{
+       struct memblock_region *reg;
+       for_each_memblock(memory, reg) {
+               phys_addr_t base = reg->base;
+               phys_addr_t top = min(base + reg->size, total_lowmem);
++              int ret;
+               if (base >= top)
+                       continue;
+@@ -134,18 +147,6 @@ void __init kasan_mmu_init(void)
+                       panic("kasan: kasan_init_region() failed");
+       }
+-      if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE) ||
+-          IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
+-              ret = kasan_init_shadow_page_tables(KASAN_SHADOW_START, KASAN_SHADOW_END);
+-
+-              if (ret)
+-                      panic("kasan: kasan_init_shadow_page_tables() failed");
+-      }
+-
+-}
+-
+-void __init kasan_init(void)
+-{
+       kasan_remap_early_shadow_ro();
+       clear_page(kasan_early_shadow_page);
diff --git a/queue-5.8/revert-powerpc-kasan-fix-shadow-pages-allocation-failure.patch b/queue-5.8/revert-powerpc-kasan-fix-shadow-pages-allocation-failure.patch
new file mode 100644 (file)
index 0000000..ff0e38c
--- /dev/null
@@ -0,0 +1,80 @@
+From b506923ee44ae87fc9f4de16b53feb313623e146 Mon Sep 17 00:00:00 2001
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+Date: Thu, 2 Jul 2020 11:52:02 +0000
+Subject: Revert "powerpc/kasan: Fix shadow pages allocation failure"
+
+From: Christophe Leroy <christophe.leroy@csgroup.eu>
+
+commit b506923ee44ae87fc9f4de16b53feb313623e146 upstream.
+
+This reverts commit d2a91cef9bbdeb87b7449fdab1a6be6000930210.
+
+This commit moved too much work in kasan_init(). The allocation
+of shadow pages has to be moved for the reason explained in that
+patch, but the allocation of page tables still need to be done
+before switching to the final hash table.
+
+First revert the incorrect commit, following patch redoes it
+properly.
+
+Fixes: d2a91cef9bbd ("powerpc/kasan: Fix shadow pages allocation failure")
+Cc: stable@vger.kernel.org
+Reported-by: Erhard F. <erhard_f@mailbox.org>
+Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=208181
+Link: https://lore.kernel.org/r/3667deb0911affbf999b99f87c31c77d5e870cd2.1593690707.git.christophe.leroy@csgroup.eu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/include/asm/kasan.h      |    2 ++
+ arch/powerpc/mm/init_32.c             |    2 ++
+ arch/powerpc/mm/kasan/kasan_init_32.c |    4 +---
+ 3 files changed, 5 insertions(+), 3 deletions(-)
+
+--- a/arch/powerpc/include/asm/kasan.h
++++ b/arch/powerpc/include/asm/kasan.h
+@@ -27,10 +27,12 @@
+ #ifdef CONFIG_KASAN
+ void kasan_early_init(void);
++void kasan_mmu_init(void);
+ void kasan_init(void);
+ void kasan_late_init(void);
+ #else
+ static inline void kasan_init(void) { }
++static inline void kasan_mmu_init(void) { }
+ static inline void kasan_late_init(void) { }
+ #endif
+--- a/arch/powerpc/mm/init_32.c
++++ b/arch/powerpc/mm/init_32.c
+@@ -171,6 +171,8 @@ void __init MMU_init(void)
+       btext_unmap();
+ #endif
++      kasan_mmu_init();
++
+       setup_kup();
+       /* Shortly after that, the entire linear mapping will be available */
+--- a/arch/powerpc/mm/kasan/kasan_init_32.c
++++ b/arch/powerpc/mm/kasan/kasan_init_32.c
+@@ -117,7 +117,7 @@ static void __init kasan_unmap_early_sha
+       kasan_update_early_region(k_start, k_end, __pte(0));
+ }
+-static void __init kasan_mmu_init(void)
++void __init kasan_mmu_init(void)
+ {
+       int ret;
+       struct memblock_region *reg;
+@@ -146,8 +146,6 @@ static void __init kasan_mmu_init(void)
+ void __init kasan_init(void)
+ {
+-      kasan_mmu_init();
+-
+       kasan_remap_early_shadow_ro();
+       clear_page(kasan_early_shadow_page);
index bd1591a07fef2c24b49859af4793774b3ab9ea46..e3ac4974192ef5b4f598ddbc273c9e1a50ddb976 100644 (file)
@@ -28,3 +28,7 @@ leds-da903x-fix-use-after-free-on-unbind.patch
 leds-lm3533-fix-use-after-free-on-unbind.patch
 leds-88pm860x-fix-use-after-free-on-unbind.patch
 gpio-max77620-fix-missing-release-of-interrupt.patch
+xattr-break-delegations-in-set-remove-xattr.patch
+revert-powerpc-kasan-fix-shadow-pages-allocation-failure.patch
+powerpc-kasan-fix-shadow-pages-allocation-failure.patch
+pci-tegra-revert-tegra124-raw_violation_fixup.patch
diff --git a/queue-5.8/xattr-break-delegations-in-set-remove-xattr.patch b/queue-5.8/xattr-break-delegations-in-set-remove-xattr.patch
new file mode 100644 (file)
index 0000000..a099053
--- /dev/null
@@ -0,0 +1,181 @@
+From 08b5d5014a27e717826999ad20e394a8811aae92 Mon Sep 17 00:00:00 2001
+From: Frank van der Linden <fllinden@amazon.com>
+Date: Tue, 23 Jun 2020 22:39:18 +0000
+Subject: xattr: break delegations in {set,remove}xattr
+
+From: Frank van der Linden <fllinden@amazon.com>
+
+commit 08b5d5014a27e717826999ad20e394a8811aae92 upstream.
+
+set/removexattr on an exported filesystem should break NFS delegations.
+This is true in general, but also for the upcoming support for
+RFC 8726 (NFSv4 extended attribute support). Make sure that they do.
+
+Additionally, they need to grow a _locked variant, since callers might
+call this with i_rwsem held (like the NFS server code).
+
+Cc: stable@vger.kernel.org # v4.9+
+Cc: linux-fsdevel@vger.kernel.org
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Frank van der Linden <fllinden@amazon.com>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/xattr.c            |   84 +++++++++++++++++++++++++++++++++++++++++++++-----
+ include/linux/xattr.h |    2 +
+ 2 files changed, 79 insertions(+), 7 deletions(-)
+
+--- a/fs/xattr.c
++++ b/fs/xattr.c
+@@ -204,10 +204,22 @@ int __vfs_setxattr_noperm(struct dentry
+       return error;
+ }
+-
++/**
++ * __vfs_setxattr_locked: set an extended attribute while holding the inode
++ * lock
++ *
++ *  @dentry - object to perform setxattr on
++ *  @name - xattr name to set
++ *  @value - value to set @name to
++ *  @size - size of @value
++ *  @flags - flags to pass into filesystem operations
++ *  @delegated_inode - on return, will contain an inode pointer that
++ *  a delegation was broken on, NULL if none.
++ */
+ int
+-vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
+-              size_t size, int flags)
++__vfs_setxattr_locked(struct dentry *dentry, const char *name,
++              const void *value, size_t size, int flags,
++              struct inode **delegated_inode)
+ {
+       struct inode *inode = dentry->d_inode;
+       int error;
+@@ -216,15 +228,40 @@ vfs_setxattr(struct dentry *dentry, cons
+       if (error)
+               return error;
+-      inode_lock(inode);
+       error = security_inode_setxattr(dentry, name, value, size, flags);
+       if (error)
+               goto out;
++      error = try_break_deleg(inode, delegated_inode);
++      if (error)
++              goto out;
++
+       error = __vfs_setxattr_noperm(dentry, name, value, size, flags);
+ out:
++      return error;
++}
++EXPORT_SYMBOL_GPL(__vfs_setxattr_locked);
++
++int
++vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
++              size_t size, int flags)
++{
++      struct inode *inode = dentry->d_inode;
++      struct inode *delegated_inode = NULL;
++      int error;
++
++retry_deleg:
++      inode_lock(inode);
++      error = __vfs_setxattr_locked(dentry, name, value, size, flags,
++          &delegated_inode);
+       inode_unlock(inode);
++
++      if (delegated_inode) {
++              error = break_deleg_wait(&delegated_inode);
++              if (!error)
++                      goto retry_deleg;
++      }
+       return error;
+ }
+ EXPORT_SYMBOL_GPL(vfs_setxattr);
+@@ -378,8 +415,18 @@ __vfs_removexattr(struct dentry *dentry,
+ }
+ EXPORT_SYMBOL(__vfs_removexattr);
++/**
++ * __vfs_removexattr_locked: set an extended attribute while holding the inode
++ * lock
++ *
++ *  @dentry - object to perform setxattr on
++ *  @name - name of xattr to remove
++ *  @delegated_inode - on return, will contain an inode pointer that
++ *  a delegation was broken on, NULL if none.
++ */
+ int
+-vfs_removexattr(struct dentry *dentry, const char *name)
++__vfs_removexattr_locked(struct dentry *dentry, const char *name,
++              struct inode **delegated_inode)
+ {
+       struct inode *inode = dentry->d_inode;
+       int error;
+@@ -388,11 +435,14 @@ vfs_removexattr(struct dentry *dentry, c
+       if (error)
+               return error;
+-      inode_lock(inode);
+       error = security_inode_removexattr(dentry, name);
+       if (error)
+               goto out;
++      error = try_break_deleg(inode, delegated_inode);
++      if (error)
++              goto out;
++
+       error = __vfs_removexattr(dentry, name);
+       if (!error) {
+@@ -401,12 +451,32 @@ vfs_removexattr(struct dentry *dentry, c
+       }
+ out:
++      return error;
++}
++EXPORT_SYMBOL_GPL(__vfs_removexattr_locked);
++
++int
++vfs_removexattr(struct dentry *dentry, const char *name)
++{
++      struct inode *inode = dentry->d_inode;
++      struct inode *delegated_inode = NULL;
++      int error;
++
++retry_deleg:
++      inode_lock(inode);
++      error = __vfs_removexattr_locked(dentry, name, &delegated_inode);
+       inode_unlock(inode);
++
++      if (delegated_inode) {
++              error = break_deleg_wait(&delegated_inode);
++              if (!error)
++                      goto retry_deleg;
++      }
++
+       return error;
+ }
+ EXPORT_SYMBOL_GPL(vfs_removexattr);
+-
+ /*
+  * Extended attribute SET operations
+  */
+--- a/include/linux/xattr.h
++++ b/include/linux/xattr.h
+@@ -52,8 +52,10 @@ ssize_t vfs_getxattr(struct dentry *, co
+ ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
+ int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int);
+ int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
++int __vfs_setxattr_locked(struct dentry *, const char *, const void *, size_t, int, struct inode **);
+ int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
+ int __vfs_removexattr(struct dentry *, const char *);
++int __vfs_removexattr_locked(struct dentry *, const char *, struct inode **);
+ int vfs_removexattr(struct dentry *, const char *);
+ ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);