linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.10 00/21] 5.10.81-rc1 review
@ 2021-11-19 17:37 Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 01/21] fortify: Explicitly disable Clang support Greg Kroah-Hartman
                   ` (28 more replies)
  0 siblings, 29 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, stable

This is the start of the stable review cycle for the 5.10.81 release.
There are 21 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
or in the git tree and branch at:
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 5.10.81-rc1

Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>
    thermal: Fix NULL pointer dereferences in of_thermal_ functions

Greg Thelen <gthelen@google.com>
    perf/core: Avoid put_page() when GUP fails

Nathan Chancellor <nathan@kernel.org>
    scripts/lld-version.sh: Rewrite based on upstream ld-version.sh

Gao Xiang <hsiangkao@linux.alibaba.com>
    erofs: fix unsafe pagevec reuse of hooked pclusters

Yue Hu <huyue2@yulong.com>
    erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()

Marc Zyngier <maz@kernel.org>
    PCI: Add MSI masking quirk for Nvidia ION AHCI

Marc Zyngier <maz@kernel.org>
    PCI/MSI: Deal with devices lying about their MSI mask capability

Thomas Gleixner <tglx@linutronix.de>
    PCI/MSI: Destroy sysfs before freeing entries

Sven Schnelle <svens@stackframe.org>
    parisc/entry: fix trace test in syscall exit path

Peter Zijlstra <peterz@infradead.org>
    x86/iopl: Fake iopl(3) CLI/STI usage

Nick Desaulniers <ndesaulniers@google.com>
    arm64: vdso32: suppress error message for 'make mrproper'

Michael Riesch <michael.riesch@wolfvision.net>
    net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings

Wong Vee Khee <vee.khee.wong@linux.intel.com>
    net: stmmac: fix issue where clk is being unprepared twice

Joakim Zhang <qiangqing.zhang@nxp.com>
    net: stmmac: fix system hang if change mac address after interface ifdown

Yang Yingliang <yangyingliang@huawei.com>
    net: stmmac: fix missing unlock on error in stmmac_suspend()

Wei Yongjun <weiyongjun1@huawei.com>
    net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP

Joakim Zhang <qiangqing.zhang@nxp.com>
    net: stmmac: add clocks management for gmac driver

Masami Hiramatsu <mhiramat@kernel.org>
    bootconfig: init: Fix memblock leak in xbc_make_cmdline()

Xie Yongji <xieyongji@bytedance.com>
    loop: Use blk_validate_block_size() to validate block size

Xie Yongji <xieyongji@bytedance.com>
    block: Add a helper to validate the block size

Kees Cook <keescook@chromium.org>
    fortify: Explicitly disable Clang support


-------------

Diffstat:

 Makefile                                           |   4 +-
 arch/arm64/kernel/vdso32/Makefile                  |   3 +-
 arch/parisc/kernel/entry.S                         |   2 +-
 arch/x86/include/asm/insn-eval.h                   |   1 +
 arch/x86/include/asm/processor.h                   |   1 +
 arch/x86/kernel/process.c                          |   1 +
 arch/x86/kernel/traps.c                            |  34 +++++++
 arch/x86/lib/insn-eval.c                           |   2 +-
 drivers/block/loop.c                               |  17 +---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     |   9 --
 drivers/net/ethernet/stmicro/stmmac/stmmac.h       |   1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  87 ++++++++++++++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 111 ++++++++++++++++-----
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  30 ++++--
 drivers/pci/msi.c                                  |  27 ++---
 drivers/pci/quirks.c                               |   6 ++
 drivers/thermal/thermal_of.c                       |   9 +-
 fs/erofs/zdata.c                                   |  15 ++-
 fs/erofs/zpvec.h                                   |  14 ++-
 include/linux/blkdev.h                             |   8 ++
 include/linux/pci.h                                |   2 +
 init/main.c                                        |   1 +
 kernel/events/core.c                               |  10 +-
 scripts/lld-version.sh                             |  35 +++++--
 security/Kconfig                                   |   3 +
 25 files changed, 320 insertions(+), 113 deletions(-)



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 01/21] fortify: Explicitly disable Clang support
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 02/21] block: Add a helper to validate the block size Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kees Cook, Nick Desaulniers,
	Nathan Chancellor

From: Kees Cook <keescook@chromium.org>

commit a52f8a59aef46b59753e583bf4b28fccb069ce64 upstream.

Clang has never correctly compiled the FORTIFY_SOURCE defenses due to
a couple bugs:

	Eliding inlines with matching __builtin_* names
	https://bugs.llvm.org/show_bug.cgi?id=50322

	Incorrect __builtin_constant_p() of some globals
	https://bugs.llvm.org/show_bug.cgi?id=41459

In the process of making improvements to the FORTIFY_SOURCE defenses, the
first (silent) bug (coincidentally) becomes worked around, but exposes
the latter which breaks the build. As such, Clang must not be used with
CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13),
and the fortify routines have been rearranged.

Update the Kconfig to reflect the reality of the current situation.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/lkml/CAKwvOd=A+ueGV2ihdy5GtgR2fQbcXjjAtVxv3=cPjffpebZB7A@mail.gmail.com
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 security/Kconfig |    3 +++
 1 file changed, 3 insertions(+)

--- a/security/Kconfig
+++ b/security/Kconfig
@@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN
 config FORTIFY_SOURCE
 	bool "Harden common str/mem functions against buffer overflows"
 	depends on ARCH_HAS_FORTIFY_SOURCE
+	# https://bugs.llvm.org/show_bug.cgi?id=50322
+	# https://bugs.llvm.org/show_bug.cgi?id=41459
+	depends on !CC_IS_CLANG
 	help
 	  Detect overflows of buffers in common string and memory functions
 	  where the compiler can determine and validate the buffer sizes.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 02/21] block: Add a helper to validate the block size
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 01/21] fortify: Explicitly disable Clang support Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate " Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xie Yongji, Jens Axboe, Tadeusz Struk

From: Xie Yongji <xieyongji@bytedance.com>

commit 570b1cac477643cbf01a45fa5d018430a1fddbce upstream.

There are some duplicated codes to validate the block
size in block drivers. This limitation actually comes
from block layer, so this patch tries to add a new block
layer helper for that.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20211026144015.188-2-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/blkdev.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -59,6 +59,14 @@ struct blk_keyslot_manager;
  */
 #define BLKCG_MAX_POLS		5
 
+static inline int blk_validate_block_size(unsigned int bsize)
+{
+	if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
+		return -EINVAL;
+
+	return 0;
+}
+
 typedef void (rq_end_io_fn)(struct request *, blk_status_t);
 
 /*



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate block size
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 01/21] fortify: Explicitly disable Clang support Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 02/21] block: Add a helper to validate the block size Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 21:45   ` Pavel Machek
  2021-11-19 17:37 ` [PATCH 5.10 04/21] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  28 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xie Yongji, Jens Axboe, Tadeusz Struk

From: Xie Yongji <xieyongji@bytedance.com>

commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream.

Remove loop_validate_block_size() and use the block layer helper
to validate block size.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20211026144015.188-4-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/block/loop.c |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -229,19 +229,6 @@ static void __loop_update_dio(struct loo
 }
 
 /**
- * loop_validate_block_size() - validates the passed in block size
- * @bsize: size to validate
- */
-static int
-loop_validate_block_size(unsigned short bsize)
-{
-	if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
-		return -EINVAL;
-
-	return 0;
-}
-
-/**
  * loop_set_size() - sets device size and notifies userspace
  * @lo: struct loop_device to set the size for
  * @size: new size of the loop device
@@ -1121,7 +1108,7 @@ static int loop_configure(struct loop_de
 	}
 
 	if (config->block_size) {
-		error = loop_validate_block_size(config->block_size);
+		error = blk_validate_block_size(config->block_size);
 		if (error)
 			goto out_unlock;
 	}
@@ -1617,7 +1604,7 @@ static int loop_set_block_size(struct lo
 	if (lo->lo_state != Lo_bound)
 		return -ENXIO;
 
-	err = loop_validate_block_size(arg);
+	err = blk_validate_block_size(arg);
 	if (err)
 		return err;
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 04/21] bootconfig: init: Fix memblock leak in xbc_make_cmdline()
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate " Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 05/21] net: stmmac: add clocks management for gmac driver Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Masami Hiramatsu, Steven Rostedt (VMware)

From: Masami Hiramatsu <mhiramat@kernel.org>

commit 1ae43851b18afe861120ebd7c426dc44f06bb2bd upstream.

Free unused memblock in a error case to fix memblock leak
in xbc_make_cmdline().

Link: https://lkml.kernel.org/r/163177339181.682366.8713781325929549256.stgit@devnote2

Fixes: 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 init/main.c |    1 +
 1 file changed, 1 insertion(+)

--- a/init/main.c
+++ b/init/main.c
@@ -380,6 +380,7 @@ static char * __init xbc_make_cmdline(co
 	ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
 	if (ret < 0 || ret > len) {
 		pr_err("Failed to print extra kernel cmdline.\n");
+		memblock_free(__pa(new_cmdline), len + 1);
 		return NULL;
 	}
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 05/21] net: stmmac: add clocks management for gmac driver
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 04/21] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 06/21] net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew Lunn, Joakim Zhang,
	David S. Miller, Meng Li

From: Joakim Zhang <qiangqing.zhang@nxp.com>

commit 5ec55823438e850c91c6b92aec93fb04ebde29e2 upstream.

This patch intends to add clocks management for stmmac driver:

If CONFIG_PM enabled:
1. Keep clocks disabled after driver probed.
2. Enable clocks when up the net device, and disable clocks when down
the net device.

If CONFIG_PM disabled:
Keep clocks always enabled after driver probed.

Note:
1. It is fine for ethtool, since the way of implementing ethtool_ops::begin
in stmmac is only can be accessed when interface is enabled, so the clocks
are ticked.
2. The MDIO bus has a different life cycle to the MAC, need ensure
clocks are enabled when _mdio_read/write() need clocks, because these
functions can be called while the interface it not opened.

Stable backport notes:
When run below command to remove ethernet driver on
stratix10 platform, there will be warning trace as below:

$ cd /sys/class/net/eth0/device/driver/
$ echo ff800000.ethernet > unbind

WARNING: CPU: 3 PID: 386 at drivers/clk/clk.c:810 clk_core_unprepare+0x114/0x274
Modules linked in: sch_fq_codel
CPU: 3 PID: 386 Comm: sh Tainted: G        W         5.10.74-yocto-standard #1
Hardware name: SoCFPGA Stratix 10 SoCDK (DT)
pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--)
pc : clk_core_unprepare+0x114/0x274
lr : clk_core_unprepare+0x114/0x274
sp : ffff800011bdbb10
clk_core_unprepare+0x114/0x274
 clk_unprepare+0x38/0x50
 stmmac_remove_config_dt+0x40/0x80
 stmmac_pltfr_remove+0x64/0x80
 platform_drv_remove+0x38/0x60
 ... ..
 el0_sync_handler+0x1a4/0x1b0
 el0_sync+0x180/0x1c0
This issue is introduced by introducing upstream commit 8f269102baf7
("net: stmmac: disable clocks in stmmac_remove_config_dt()")

But in latest mainline kernel, there is no this issue. Because this
patch improved clocks management for stmmac driver.
Therefore, backport it and its fixing patches to stable kernel v5.10.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: stable@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h          |    1 
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     |   75 ++++++++++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c     |  111 +++++++++++++-----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |   24 +++
 4 files changed, 174 insertions(+), 37 deletions(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -270,6 +270,7 @@ void stmmac_disable_eee_mode(struct stmm
 bool stmmac_eee_init(struct stmmac_priv *priv);
 int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt);
 int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size);
+int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled);
 
 #if IS_ENABLED(CONFIG_STMMAC_SELFTESTS)
 void stmmac_selftest_run(struct net_device *dev,
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -28,6 +28,7 @@
 #include <linux/if_vlan.h>
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 #include <linux/prefetch.h>
 #include <linux/pinctrl/consumer.h>
 #ifdef CONFIG_DEBUG_FS
@@ -113,6 +114,28 @@ static void stmmac_exit_fs(struct net_de
 
 #define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
 
+int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled)
+{
+	int ret = 0;
+
+	if (enabled) {
+		ret = clk_prepare_enable(priv->plat->stmmac_clk);
+		if (ret)
+			return ret;
+		ret = clk_prepare_enable(priv->plat->pclk);
+		if (ret) {
+			clk_disable_unprepare(priv->plat->stmmac_clk);
+			return ret;
+		}
+	} else {
+		clk_disable_unprepare(priv->plat->stmmac_clk);
+		clk_disable_unprepare(priv->plat->pclk);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(stmmac_bus_clks_config);
+
 /**
  * stmmac_verify_args - verify the driver parameters.
  * Description: it checks the driver parameters and set a default in case of
@@ -2792,6 +2815,12 @@ static int stmmac_open(struct net_device
 	u32 chan;
 	int ret;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	if (priv->hw->pcs != STMMAC_PCS_TBI &&
 	    priv->hw->pcs != STMMAC_PCS_RTBI &&
 	    priv->hw->xpcs == NULL) {
@@ -2800,7 +2829,7 @@ static int stmmac_open(struct net_device
 			netdev_err(priv->dev,
 				   "%s: Cannot attach to PHY (error: %d)\n",
 				   __func__, ret);
-			return ret;
+			goto init_phy_error;
 		}
 	}
 
@@ -2915,6 +2944,8 @@ init_error:
 	free_dma_desc_resources(priv);
 dma_desc_error:
 	phylink_disconnect_phy(priv->phylink);
+init_phy_error:
+	pm_runtime_put(priv->device);
 	return ret;
 }
 
@@ -2965,6 +2996,8 @@ static int stmmac_release(struct net_dev
 
 	stmmac_release_ptp(priv);
 
+	pm_runtime_put(priv->device);
+
 	return 0;
 }
 
@@ -4616,6 +4649,12 @@ static int stmmac_vlan_rx_kill_vid(struc
 	bool is_double = false;
 	int ret;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	if (be16_to_cpu(proto) == ETH_P_8021AD)
 		is_double = true;
 
@@ -4624,10 +4663,15 @@ static int stmmac_vlan_rx_kill_vid(struc
 	if (priv->hw->num_vlan) {
 		ret = stmmac_del_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid);
 		if (ret)
-			return ret;
+			goto del_vlan_error;
 	}
 
-	return stmmac_vlan_update(priv, is_double);
+	ret = stmmac_vlan_update(priv, is_double);
+
+del_vlan_error:
+	pm_runtime_put(priv->device);
+
+	return ret;
 }
 
 static const struct net_device_ops stmmac_netdev_ops = {
@@ -5066,6 +5110,10 @@ int stmmac_dvr_probe(struct device *devi
 
 	stmmac_check_pcs_mode(priv);
 
+	pm_runtime_get_noresume(device);
+	pm_runtime_set_active(device);
+	pm_runtime_enable(device);
+
 	if (priv->hw->pcs != STMMAC_PCS_TBI &&
 	    priv->hw->pcs != STMMAC_PCS_RTBI) {
 		/* MDIO bus Registration */
@@ -5103,6 +5151,11 @@ int stmmac_dvr_probe(struct device *devi
 	stmmac_init_fs(ndev);
 #endif
 
+	/* Let pm_runtime_put() disable the clocks.
+	 * If CONFIG_PM is not enabled, the clocks will stay powered.
+	 */
+	pm_runtime_put(device);
+
 	return ret;
 
 error_serdes_powerup:
@@ -5117,6 +5170,7 @@ error_mdio_register:
 	stmmac_napi_del(ndev);
 error_hw_init:
 	destroy_workqueue(priv->wq);
+	stmmac_bus_clks_config(priv, false);
 
 	return ret;
 }
@@ -5152,8 +5206,8 @@ int stmmac_dvr_remove(struct device *dev
 	phylink_destroy(priv->phylink);
 	if (priv->plat->stmmac_rst)
 		reset_control_assert(priv->plat->stmmac_rst);
-	clk_disable_unprepare(priv->plat->pclk);
-	clk_disable_unprepare(priv->plat->stmmac_clk);
+	pm_runtime_put(dev);
+	pm_runtime_disable(dev);
 	if (priv->hw->pcs != STMMAC_PCS_TBI &&
 	    priv->hw->pcs != STMMAC_PCS_RTBI)
 		stmmac_mdio_unregister(ndev);
@@ -5176,6 +5230,7 @@ int stmmac_suspend(struct device *dev)
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	u32 chan;
+	int ret;
 
 	if (!ndev || !netif_running(ndev))
 		return 0;
@@ -5219,8 +5274,9 @@ int stmmac_suspend(struct device *dev)
 		pinctrl_pm_select_sleep_state(priv->device);
 		/* Disable clock in case of PWM is off */
 		clk_disable_unprepare(priv->plat->clk_ptp_ref);
-		clk_disable_unprepare(priv->plat->pclk);
-		clk_disable_unprepare(priv->plat->stmmac_clk);
+		ret = pm_runtime_force_suspend(dev);
+		if (ret)
+			return ret;
 	}
 	mutex_unlock(&priv->lock);
 
@@ -5286,8 +5342,9 @@ int stmmac_resume(struct device *dev)
 	} else {
 		pinctrl_pm_select_default_state(priv->device);
 		/* enable the clk previously disabled */
-		clk_prepare_enable(priv->plat->stmmac_clk);
-		clk_prepare_enable(priv->plat->pclk);
+		ret = pm_runtime_force_resume(dev);
+		if (ret)
+			return ret;
 		if (priv->plat->clk_ptp_ref)
 			clk_prepare_enable(priv->plat->clk_ptp_ref);
 		/* reset the phy so that it's ready */
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -15,6 +15,7 @@
 #include <linux/iopoll.h>
 #include <linux/mii.h>
 #include <linux/of_mdio.h>
+#include <linux/pm_runtime.h>
 #include <linux/phy.h>
 #include <linux/property.h>
 #include <linux/slab.h>
@@ -87,21 +88,29 @@ static int stmmac_xgmac2_mdio_read(struc
 	u32 tmp, addr, value = MII_XGMAC_BUSY;
 	int ret;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
-		return -EBUSY;
+			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	if (phyreg & MII_ADDR_C45) {
 		phyreg &= ~MII_ADDR_C45;
 
 		ret = stmmac_xgmac2_c45_format(priv, phyaddr, phyreg, &addr);
 		if (ret)
-			return ret;
+			goto err_disable_clks;
 	} else {
 		ret = stmmac_xgmac2_c22_format(priv, phyaddr, phyreg, &addr);
 		if (ret)
-			return ret;
+			goto err_disable_clks;
 
 		value |= MII_XGMAC_SADDR;
 	}
@@ -112,8 +121,10 @@ static int stmmac_xgmac2_mdio_read(struc
 
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
-		return -EBUSY;
+			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	/* Set the MII address register to read */
 	writel(addr, priv->ioaddr + mii_address);
@@ -121,11 +132,18 @@ static int stmmac_xgmac2_mdio_read(struc
 
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
-		return -EBUSY;
+			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	/* Read the data from the MII data register */
-	return readl(priv->ioaddr + mii_data) & GENMASK(15, 0);
+	ret = (int)readl(priv->ioaddr + mii_data) & GENMASK(15, 0);
+
+err_disable_clks:
+	pm_runtime_put(priv->device);
+
+	return ret;
 }
 
 static int stmmac_xgmac2_mdio_write(struct mii_bus *bus, int phyaddr,
@@ -138,21 +156,29 @@ static int stmmac_xgmac2_mdio_write(stru
 	u32 addr, tmp, value = MII_XGMAC_BUSY;
 	int ret;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
-		return -EBUSY;
+			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	if (phyreg & MII_ADDR_C45) {
 		phyreg &= ~MII_ADDR_C45;
 
 		ret = stmmac_xgmac2_c45_format(priv, phyaddr, phyreg, &addr);
 		if (ret)
-			return ret;
+			goto err_disable_clks;
 	} else {
 		ret = stmmac_xgmac2_c22_format(priv, phyaddr, phyreg, &addr);
 		if (ret)
-			return ret;
+			goto err_disable_clks;
 
 		value |= MII_XGMAC_SADDR;
 	}
@@ -164,16 +190,23 @@ static int stmmac_xgmac2_mdio_write(stru
 
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-			       !(tmp & MII_XGMAC_BUSY), 100, 10000))
-		return -EBUSY;
+			       !(tmp & MII_XGMAC_BUSY), 100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	/* Set the MII address register to write */
 	writel(addr, priv->ioaddr + mii_address);
 	writel(value, priv->ioaddr + mii_data);
 
 	/* Wait until any existing MII operation is complete */
-	return readl_poll_timeout(priv->ioaddr + mii_data, tmp,
-				  !(tmp & MII_XGMAC_BUSY), 100, 10000);
+	ret = readl_poll_timeout(priv->ioaddr + mii_data, tmp,
+				 !(tmp & MII_XGMAC_BUSY), 100, 10000);
+
+err_disable_clks:
+	pm_runtime_put(priv->device);
+
+	return ret;
 }
 
 /**
@@ -196,6 +229,12 @@ static int stmmac_mdio_read(struct mii_b
 	int data = 0;
 	u32 v;
 
+	data = pm_runtime_get_sync(priv->device);
+	if (data < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return data;
+	}
+
 	value |= (phyaddr << priv->hw->mii.addr_shift)
 		& priv->hw->mii.addr_mask;
 	value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
@@ -216,19 +255,26 @@ static int stmmac_mdio_read(struct mii_b
 	}
 
 	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
-			       100, 10000))
-		return -EBUSY;
+			       100, 10000)) {
+		data = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	writel(data, priv->ioaddr + mii_data);
 	writel(value, priv->ioaddr + mii_address);
 
 	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
-			       100, 10000))
-		return -EBUSY;
+			       100, 10000)) {
+		data = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	/* Read the data from the MII data register */
 	data = (int)readl(priv->ioaddr + mii_data) & MII_DATA_MASK;
 
+err_disable_clks:
+	pm_runtime_put(priv->device);
+
 	return data;
 }
 
@@ -247,10 +293,16 @@ static int stmmac_mdio_write(struct mii_
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
 	unsigned int mii_data = priv->hw->mii.data;
+	int ret, data = phydata;
 	u32 value = MII_BUSY;
-	int data = phydata;
 	u32 v;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	value |= (phyaddr << priv->hw->mii.addr_shift)
 		& priv->hw->mii.addr_mask;
 	value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
@@ -275,16 +327,23 @@ static int stmmac_mdio_write(struct mii_
 
 	/* Wait until any existing MII operation is complete */
 	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
-			       100, 10000))
-		return -EBUSY;
+			       100, 10000)) {
+		ret = -EBUSY;
+		goto err_disable_clks;
+	}
 
 	/* Set the MII address register to write */
 	writel(data, priv->ioaddr + mii_data);
 	writel(value, priv->ioaddr + mii_address);
 
 	/* Wait until any existing MII operation is complete */
-	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
-				  100, 10000);
+	ret = readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+				 100, 10000);
+
+err_disable_clks:
+	pm_runtime_put(priv->device);
+
+	return ret;
 }
 
 /**
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -760,10 +760,30 @@ static int stmmac_pltfr_resume(struct de
 
 	return stmmac_resume(dev);
 }
+
+static int stmmac_runtime_suspend(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	struct stmmac_priv *priv = netdev_priv(ndev);
+
+	stmmac_bus_clks_config(priv, false);
+
+	return 0;
+}
+
+static int stmmac_runtime_resume(struct device *dev)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	struct stmmac_priv *priv = netdev_priv(ndev);
+
+	return stmmac_bus_clks_config(priv, true);
+}
 #endif /* CONFIG_PM_SLEEP */
 
-SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
-				       stmmac_pltfr_resume);
+const struct dev_pm_ops stmmac_pltfr_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stmmac_pltfr_suspend, stmmac_pltfr_resume)
+	SET_RUNTIME_PM_OPS(stmmac_runtime_suspend, stmmac_runtime_resume, NULL)
+};
 EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
 
 MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet platform support");



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 06/21] net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 05/21] net: stmmac: add clocks management for gmac driver Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 07/21] net: stmmac: fix missing unlock on error in stmmac_suspend() Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Wei Yongjun,
	David S. Miller, Meng Li

From: Wei Yongjun <weiyongjun1@huawei.com>

commit 7ec05a6035480f3a5934b2b31222620b2e906163 upstream

Get rid of the CONFIG_PM_SLEEP ifdefery to fix the build error
and use __maybe_unused for the suspend()/resume() hooks to avoid
build warning:

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:769:21:
 error: 'stmmac_runtime_suspend' undeclared here (not in a function); did you mean 'stmmac_suspend'?
  769 |  SET_RUNTIME_PM_OPS(stmmac_runtime_suspend, stmmac_runtime_resume, NULL)
      |                     ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/pm.h:342:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
  342 |  .runtime_suspend = suspend_fn, \
      |                     ^~~~~~~~~~
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:769:45:
 error: 'stmmac_runtime_resume' undeclared here (not in a function)
  769 |  SET_RUNTIME_PM_OPS(stmmac_runtime_suspend, stmmac_runtime_resume, NULL)
      |                                             ^~~~~~~~~~~~~~~~~~~~~
./include/linux/pm.h:343:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
  343 |  .runtime_resume = resume_fn, \
      |                    ^~~~~~~~~

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -720,7 +720,6 @@ int stmmac_pltfr_remove(struct platform_
 }
 EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
 
-#ifdef CONFIG_PM_SLEEP
 /**
  * stmmac_pltfr_suspend
  * @dev: device pointer
@@ -728,7 +727,7 @@ EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
  * call the main suspend function and then, if required, on some platform, it
  * can call an exit helper.
  */
-static int stmmac_pltfr_suspend(struct device *dev)
+static int __maybe_unused stmmac_pltfr_suspend(struct device *dev)
 {
 	int ret;
 	struct net_device *ndev = dev_get_drvdata(dev);
@@ -749,7 +748,7 @@ static int stmmac_pltfr_suspend(struct d
  * the main resume function, on some platforms, it can call own init helper
  * if required.
  */
-static int stmmac_pltfr_resume(struct device *dev)
+static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
 {
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -761,7 +760,7 @@ static int stmmac_pltfr_resume(struct de
 	return stmmac_resume(dev);
 }
 
-static int stmmac_runtime_suspend(struct device *dev)
+static int __maybe_unused stmmac_runtime_suspend(struct device *dev)
 {
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -771,14 +770,13 @@ static int stmmac_runtime_suspend(struct
 	return 0;
 }
 
-static int stmmac_runtime_resume(struct device *dev)
+static int __maybe_unused stmmac_runtime_resume(struct device *dev)
 {
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
 
 	return stmmac_bus_clks_config(priv, true);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 const struct dev_pm_ops stmmac_pltfr_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(stmmac_pltfr_suspend, stmmac_pltfr_resume)



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 07/21] net: stmmac: fix missing unlock on error in stmmac_suspend()
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 06/21] net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 08/21] net: stmmac: fix system hang if change mac address after interface ifdown Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hulk Robot, Yang Yingliang,
	David S. Miller, Meng Li

From: Yang Yingliang <yangyingliang@huawei.com>

commit 30f347ae7cc1178c431f968a89d4b4a375bc0d39 upstream

Add the missing unlock before return from stmmac_suspend()
in the error handling case.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5275,8 +5275,10 @@ int stmmac_suspend(struct device *dev)
 		/* Disable clock in case of PWM is off */
 		clk_disable_unprepare(priv->plat->clk_ptp_ref);
 		ret = pm_runtime_force_suspend(dev);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&priv->lock);
 			return ret;
+		}
 	}
 	mutex_unlock(&priv->lock);
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 08/21] net: stmmac: fix system hang if change mac address after interface ifdown
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 07/21] net: stmmac: fix missing unlock on error in stmmac_suspend() Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 09/21] net: stmmac: fix issue where clk is being unprepared twice Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Joakim Zhang, David S. Miller, Meng Li

From: Joakim Zhang <qiangqing.zhang@nxp.com>

commit 4691ffb18ac908609aab07d13af7995b6b89d33c upstream.

Fix system hang with below sequences:
~# ifconfig ethx down
~# ifconfig ethx hw ether xx:xx:xx:xx:xx:xx

After ethx down, stmmac all clocks gated off and then register access causes
system hang.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4324,12 +4324,21 @@ static int stmmac_set_mac_address(struct
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	int ret = 0;
 
+	ret = pm_runtime_get_sync(priv->device);
+	if (ret < 0) {
+		pm_runtime_put_noidle(priv->device);
+		return ret;
+	}
+
 	ret = eth_mac_addr(ndev, addr);
 	if (ret)
-		return ret;
+		goto set_mac_error;
 
 	stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0);
 
+set_mac_error:
+	pm_runtime_put(priv->device);
+
 	return ret;
 }
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 09/21] net: stmmac: fix issue where clk is being unprepared twice
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 08/21] net: stmmac: fix system hang if change mac address after interface ifdown Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 10/21] net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Joakim Zhang, Wong Vee Khee,
	David S. Miller, Meng Li

From: Wong Vee Khee <vee.khee.wong@linux.intel.com>

commit ab00f3e051e851a8458f0d0eb1bb426deadb6619 upstream.

In the case of MDIO bus registration failure due to no external PHY
devices is connected to the MAC, clk_disable_unprepare() is called in
stmmac_bus_clk_config() and intel_eth_pci_probe() respectively.

The second call in intel_eth_pci_probe() will caused the following:-

[   16.578605] intel-eth-pci 0000:00:1e.5: No PHY found
[   16.583778] intel-eth-pci 0000:00:1e.5: stmmac_dvr_probe: MDIO bus (id: 2) registration failed
[   16.680181] ------------[ cut here ]------------
[   16.684861] stmmac-0000:00:1e.5 already disabled
[   16.689547] WARNING: CPU: 13 PID: 2053 at drivers/clk/clk.c:952 clk_core_disable+0x96/0x1b0
[   16.697963] Modules linked in: dwc3 iTCO_wdt mei_hdcp iTCO_vendor_support udc_core x86_pkg_temp_thermal kvm_intel marvell10g kvm sch_fq_codel nfsd irqbypass dwmac_intel(+) stmmac uio ax88179_178a pcs_xpcs phylink uhid spi_pxa2xx_platform usbnet mei_me pcspkr tpm_crb mii i2c_i801 dw_dmac dwc3_pci thermal dw_dmac_core intel_rapl_msr libphy i2c_smbus mei tpm_tis intel_th_gth tpm_tis_core tpm intel_th_acpi intel_pmc_core intel_th i915 fuse configfs snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core snd_pcm snd_timer snd soundcore
[   16.746785] CPU: 13 PID: 2053 Comm: systemd-udevd Tainted: G     U            5.13.0-rc3-intel-lts #76
[   16.756134] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-S ADP-S DRR4 CRB, BIOS ADLIFSI1.R00.1494.B00.2012031421 12/03/2020
[   16.769465] RIP: 0010:clk_core_disable+0x96/0x1b0
[   16.774222] Code: 00 8b 05 45 96 17 01 85 c0 7f 24 48 8b 5b 30 48 85 db 74 a5 8b 43 7c 85 c0 75 93 48 8b 33 48 c7 c7 6e 32 cc b7 e8 b2 5d 52 00 <0f> 0b 5b 5d c3 65 8b 05 76 31 18 49 89 c0 48 0f a3 05 bc 92 1a 01
[   16.793016] RSP: 0018:ffffa44580523aa0 EFLAGS: 00010086
[   16.798287] RAX: 0000000000000000 RBX: ffff8d7d0eb70a00 RCX: 0000000000000000
[   16.805435] RDX: 0000000000000002 RSI: ffffffffb7c62d5f RDI: 00000000ffffffff
[   16.812610] RBP: 0000000000000287 R08: 0000000000000000 R09: ffffa445805238d0
[   16.819759] R10: 0000000000000001 R11: 0000000000000001 R12: ffff8d7d0eb70a00
[   16.826904] R13: ffff8d7d027370c8 R14: 0000000000000006 R15: ffffa44580523ad0
[   16.834047] FS:  00007f9882fa2600(0000) GS:ffff8d80a0940000(0000) knlGS:0000000000000000
[   16.842177] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   16.847966] CR2: 00007f9882bea3d8 CR3: 000000010b126001 CR4: 0000000000370ee0
[   16.855144] Call Trace:
[   16.857614]  clk_core_disable_lock+0x1b/0x30
[   16.861941]  intel_eth_pci_probe.cold+0x11d/0x136 [dwmac_intel]
[   16.867913]  pci_device_probe+0xcf/0x150
[   16.871890]  really_probe+0xf5/0x3e0
[   16.875526]  driver_probe_device+0x64/0x150
[   16.879763]  device_driver_attach+0x53/0x60
[   16.883998]  __driver_attach+0x9f/0x150
[   16.887883]  ? device_driver_attach+0x60/0x60
[   16.892288]  ? device_driver_attach+0x60/0x60
[   16.896698]  bus_for_each_dev+0x77/0xc0
[   16.900583]  bus_add_driver+0x184/0x1f0
[   16.904469]  driver_register+0x6c/0xc0
[   16.908268]  ? 0xffffffffc07ae000
[   16.911598]  do_one_initcall+0x4a/0x210
[   16.915489]  ? kmem_cache_alloc_trace+0x305/0x4e0
[   16.920247]  do_init_module+0x5c/0x230
[   16.924057]  load_module+0x2894/0x2b70
[   16.927857]  ? __do_sys_finit_module+0xb5/0x120
[   16.932441]  __do_sys_finit_module+0xb5/0x120
[   16.936845]  do_syscall_64+0x42/0x80
[   16.940476]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[   16.945586] RIP: 0033:0x7f98830e5ccd
[   16.949177] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 93 31 0c 00 f7 d8 64 89 01 48
[   16.967970] RSP: 002b:00007ffc66b60168 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   16.975583] RAX: ffffffffffffffda RBX: 000055885de35ef0 RCX: 00007f98830e5ccd
[   16.982725] RDX: 0000000000000000 RSI: 00007f98832541e3 RDI: 0000000000000012
[   16.989868] RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000000
[   16.997042] R10: 0000000000000012 R11: 0000000000000246 R12: 00007f98832541e3
[   17.004222] R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffc66b60328
[   17.011369] ---[ end trace df06a3dab26b988c ]---
[   17.016062] ------------[ cut here ]------------
[   17.020701] stmmac-0000:00:1e.5 already unprepared

Removing the stmmac_bus_clks_config() call in stmmac_dvr_probe and let
dwmac-intel to handle the unprepare and disable of the clk device.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Reviewed-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    1 -
 1 file changed, 1 deletion(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5179,7 +5179,6 @@ error_mdio_register:
 	stmmac_napi_del(ndev);
 error_hw_init:
 	destroy_workqueue(priv->wq);
-	stmmac_bus_clks_config(priv, false);
 
 	return ret;
 }



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 10/21] net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 09/21] net: stmmac: fix issue where clk is being unprepared twice Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Michael Riesch, David S. Miller, Meng Li

From: Michael Riesch <michael.riesch@wolfvision.net>

commit 2d26f6e39afb88d32b8f39e76a51b542c3c51674 upstream.

This reverts commit 2c896fb02e7f65299646f295a007bda043e0f382
"net: stmmac: dwmac-rk: add pd_gmac support for rk3399" and fixes
unbalanced pm_runtime_enable warnings.

In the commit to be reverted, support for power management was
introduced to the Rockchip glue code. Later, power management support
was introduced to the stmmac core code, resulting in multiple
invocations of pm_runtime_{enable,disable,get_sync,put_sync}.

The multiple invocations happen in rk_gmac_powerup and
stmmac_{dvr_probe, resume} as well as in rk_gmac_powerdown and
stmmac_{dvr_remove, suspend}, respectively, which are always called
in conjunction.

Fixes: 5ec55823438e850c91c6b92aec93fb04ebde29e2 ("net: stmmac: add clocks management for gmac driver")
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |    9 ---------
 1 file changed, 9 deletions(-)

--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -21,7 +21,6 @@
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
-#include <linux/pm_runtime.h>
 
 #include "stmmac_platform.h"
 
@@ -1336,9 +1335,6 @@ static int rk_gmac_powerup(struct rk_pri
 		return ret;
 	}
 
-	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
-
 	if (bsp_priv->integrated_phy)
 		rk_gmac_integrated_phy_powerup(bsp_priv);
 
@@ -1347,14 +1343,9 @@ static int rk_gmac_powerup(struct rk_pri
 
 static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 {
-	struct device *dev = &gmac->pdev->dev;
-
 	if (gmac->integrated_phy)
 		rk_gmac_integrated_phy_powerdown(gmac);
 
-	pm_runtime_put_sync(dev);
-	pm_runtime_disable(dev);
-
 	phy_power_on(gmac, false);
 	gmac_clk_enable(gmac, false);
 }



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 10/21] net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 21:47   ` Pavel Machek
  2021-11-19 17:37 ` [PATCH 5.10 12/21] x86/iopl: Fake iopl(3) CLI/STI usage Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  28 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lucas Henneman, Masahiro Yamada,
	Nick Desaulniers, Vincenzo Frascino, Nathan Chancellor,
	Will Deacon

From: Nick Desaulniers <ndesaulniers@google.com>

commit 14831fad73f5ac30ac61760487d95a538e6ab3cb upstream.

When running the following command without arm-linux-gnueabi-gcc in
one's $PATH, the following warning is observed:

$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
make[1]: arm-linux-gnueabi-gcc: No such file or directory

This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
is not set, and we end up eagerly evaluating various variables that try
to invoke CC_COMPAT.

This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")

Reported-by: Lucas Henneman <henneman@google.com>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211019223646.1146945-4-ndesaulniers@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/vdso32/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -48,7 +48,8 @@ cc32-as-instr = $(call try-run,\
 # As a result we set our own flags here.
 
 # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
-VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
+VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc
+VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include)
 VDSO_CPPFLAGS += $(LINUXINCLUDE)
 
 # Common C and assembly flags



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 12/21] x86/iopl: Fake iopl(3) CLI/STI usage
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 13/21] parisc/entry: fix trace test in syscall exit path Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ondrej Zary, Peter Zijlstra (Intel),
	Thomas Gleixner, stable

From: Peter Zijlstra <peterz@infradead.org>

commit b968e84b509da593c50dc3db679e1d33de701f78 upstream.

Since commit c8137ace5638 ("x86/iopl: Restrict iopl() permission
scope") it's possible to emulate iopl(3) using ioperm(), except for
the CLI/STI usage.

Userspace CLI/STI usage is very dubious (read broken), since any
exception taken during that window can lead to rescheduling anyway (or
worse). The IOPL(2) manpage even states that usage of CLI/STI is highly
discouraged and might even crash the system.

Of course, that won't stop people and HP has the dubious honour of
being the first vendor to be found using this in their hp-health
package.

In order to enable this 'software' to still 'work', have the #GP treat
the CLI/STI instructions as NOPs when iopl(3). Warn the user that
their program is doing dubious things.

Fixes: a24ca9976843 ("x86/iopl: Remove legacy IOPL option")
Reported-by: Ondrej Zary <linux@zary.sk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@kernel.org # v5.5+
Link: https://lkml.kernel.org/r/20210918090641.GD5106@worktop.programming.kicks-ass.net
Signed-off-by: Ondrej Zary <linux@zary.sk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/include/asm/insn-eval.h |    1 +
 arch/x86/include/asm/processor.h |    1 +
 arch/x86/kernel/process.c        |    1 +
 arch/x86/kernel/traps.c          |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/lib/insn-eval.c         |    2 +-
 5 files changed, 38 insertions(+), 1 deletion(-)

--- a/arch/x86/include/asm/insn-eval.h
+++ b/arch/x86/include/asm/insn-eval.h
@@ -21,6 +21,7 @@ int insn_get_modrm_rm_off(struct insn *i
 int insn_get_modrm_reg_off(struct insn *insn, struct pt_regs *regs);
 unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx);
 int insn_get_code_seg_params(struct pt_regs *regs);
+unsigned long insn_get_effective_ip(struct pt_regs *regs);
 int insn_fetch_from_user(struct pt_regs *regs,
 			 unsigned char buf[MAX_INSN_SIZE]);
 int insn_fetch_from_user_inatomic(struct pt_regs *regs,
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -534,6 +534,7 @@ struct thread_struct {
 	 */
 	unsigned long		iopl_emul;
 
+	unsigned int		iopl_warn:1;
 	unsigned int		sig_on_uaccess_err:1;
 
 	/* Floating point and extended processor state */
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -138,6 +138,7 @@ int copy_thread(unsigned long clone_flag
 	frame->ret_addr = (unsigned long) ret_from_fork;
 	p->thread.sp = (unsigned long) fork_frame;
 	p->thread.io_bitmap = NULL;
+	p->thread.iopl_warn = 0;
 	memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
 
 #ifdef CONFIG_X86_64
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -523,6 +523,37 @@ static enum kernel_gp_hint get_kernel_gp
 
 #define GPFSTR "general protection fault"
 
+static bool fixup_iopl_exception(struct pt_regs *regs)
+{
+	struct thread_struct *t = &current->thread;
+	unsigned char byte;
+	unsigned long ip;
+
+	if (!IS_ENABLED(CONFIG_X86_IOPL_IOPERM) || t->iopl_emul != 3)
+		return false;
+
+	ip = insn_get_effective_ip(regs);
+	if (!ip)
+		return false;
+
+	if (get_user(byte, (const char __user *)ip))
+		return false;
+
+	if (byte != 0xfa && byte != 0xfb)
+		return false;
+
+	if (!t->iopl_warn && printk_ratelimit()) {
+		pr_err("%s[%d] attempts to use CLI/STI, pretending it's a NOP, ip:%lx",
+		       current->comm, task_pid_nr(current), ip);
+		print_vma_addr(KERN_CONT " in ", ip);
+		pr_cont("\n");
+		t->iopl_warn = 1;
+	}
+
+	regs->ip += 1;
+	return true;
+}
+
 DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
 {
 	char desc[sizeof(GPFSTR) + 50 + 2*sizeof(unsigned long) + 1] = GPFSTR;
@@ -548,6 +579,9 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_pr
 	tsk = current;
 
 	if (user_mode(regs)) {
+		if (fixup_iopl_exception(regs))
+			goto exit;
+
 		tsk->thread.error_code = error_code;
 		tsk->thread.trap_nr = X86_TRAP_GP;
 
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -1415,7 +1415,7 @@ void __user *insn_get_addr_ref(struct in
 	}
 }
 
-static unsigned long insn_get_effective_ip(struct pt_regs *regs)
+unsigned long insn_get_effective_ip(struct pt_regs *regs)
 {
 	unsigned long seg_base = 0;
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 13/21] parisc/entry: fix trace test in syscall exit path
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 12/21] x86/iopl: Fake iopl(3) CLI/STI usage Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 14/21] PCI/MSI: Destroy sysfs before freeing entries Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sven Schnelle, Helge Deller

From: Sven Schnelle <svens@stackframe.org>

commit 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a upstream.

commit 8779e05ba8aa ("parisc: Fix ptrace check on syscall return")
fixed testing of TI_FLAGS. This uncovered a bug in the test mask.
syscall_restore_rfi is only used when the kernel needs to exit to
usespace with single or block stepping and the recovery counter
enabled. The test however used _TIF_SYSCALL_TRACE_MASK, which
includes a lot of bits that shouldn't be tested here.

Fix this by using TIF_SINGLESTEP and TIF_BLOCKSTEP directly.

I encountered this bug by enabling syscall tracepoints. Both in qemu and
on real hardware. As soon as i enabled the tracepoint (sys_exit_read,
but i guess it doesn't really matter which one), i got random page
faults in userspace almost immediately.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/parisc/kernel/entry.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -1849,7 +1849,7 @@ syscall_restore:
 
 	/* Are we being ptraced? */
 	LDREG	TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
-	ldi	_TIF_SYSCALL_TRACE_MASK,%r2
+	ldi	_TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
 	and,COND(=)	%r19,%r2,%r0
 	b,n	syscall_restore_rfi
 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 14/21] PCI/MSI: Destroy sysfs before freeing entries
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 13/21] parisc/entry: fix trace test in syscall exit path Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 15/21] PCI/MSI: Deal with devices lying about their MSI mask capability Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Thomas Gleixner, Bjorn Helgaas

From: Thomas Gleixner <tglx@linutronix.de>

commit 3735459037114d31e5acd9894fad9aed104231a0 upstream.

free_msi_irqs() frees the MSI entries before destroying the sysfs entries
which are exposing them. Nothing prevents a concurrent free while a sysfs
file is read and accesses the possibly freed entry.

Move the sysfs release ahead of freeing the entries.

Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/87sfw5305m.ffs@tglx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/msi.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -396,18 +396,6 @@ static void free_msi_irqs(struct pci_dev
 			for (i = 0; i < entry->nvec_used; i++)
 				BUG_ON(irq_has_action(entry->irq + i));
 
-	pci_msi_teardown_msi_irqs(dev);
-
-	list_for_each_entry_safe(entry, tmp, msi_list, list) {
-		if (entry->msi_attrib.is_msix) {
-			if (list_is_last(&entry->list, msi_list))
-				iounmap(entry->mask_base);
-		}
-
-		list_del(&entry->list);
-		free_msi_entry(entry);
-	}
-
 	if (dev->msi_irq_groups) {
 		sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
 		msi_attrs = dev->msi_irq_groups[0]->attrs;
@@ -423,6 +411,18 @@ static void free_msi_irqs(struct pci_dev
 		kfree(dev->msi_irq_groups);
 		dev->msi_irq_groups = NULL;
 	}
+
+	pci_msi_teardown_msi_irqs(dev);
+
+	list_for_each_entry_safe(entry, tmp, msi_list, list) {
+		if (entry->msi_attrib.is_msix) {
+			if (list_is_last(&entry->list, msi_list))
+				iounmap(entry->mask_base);
+		}
+
+		list_del(&entry->list);
+		free_msi_entry(entry);
+	}
 }
 
 static void pci_intx_for_msi(struct pci_dev *dev, int enable)



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 15/21] PCI/MSI: Deal with devices lying about their MSI mask capability
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 14/21] PCI/MSI: Destroy sysfs before freeing entries Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 16/21] PCI: Add MSI masking quirk for Nvidia ION AHCI Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Zyngier, Thomas Gleixner, Bjorn Helgaas

From: Marc Zyngier <maz@kernel.org>

commit 2226667a145db2e1f314d7f57fd644fe69863ab9 upstream.

It appears that some devices are lying about their mask capability,
pretending that they don't have it, while they actually do.
The net result is that now that we don't enable MSIs on such
endpoint.

Add a new per-device flag to deal with this. Further patches will
make use of it, sadly.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20211104180130.3825416-2-maz@kernel.org
Cc: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/msi.c   |    3 +++
 include/linux/pci.h |    2 ++
 2 files changed, 5 insertions(+)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -592,6 +592,9 @@ msi_setup_entry(struct pci_dev *dev, int
 		goto out;
 
 	pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
+	/* Lies, damned lies, and MSIs */
+	if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING)
+		control |= PCI_MSI_FLAGS_MASKBIT;
 
 	entry->msi_attrib.is_msix	= 0;
 	entry->msi_attrib.is_64		= !!(control & PCI_MSI_FLAGS_64BIT);
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -227,6 +227,8 @@ enum pci_dev_flags {
 	PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),
 	/* Don't use Relaxed Ordering for TLPs directed at this device */
 	PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11),
+	/* Device does honor MSI masking despite saying otherwise */
+	PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12),
 };
 
 enum pci_irq_reroute_variant {



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 16/21] PCI: Add MSI masking quirk for Nvidia ION AHCI
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 15/21] PCI/MSI: Deal with devices lying about their MSI mask capability Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 17/21] erofs: remove the occupied parameter from z_erofs_pagevec_enqueue() Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rui Salvaterra, Marc Zyngier,
	Thomas Gleixner, Bjorn Helgaas

From: Marc Zyngier <maz@kernel.org>

commit f21082fb20dbfb3e42b769b59ef21c2a7f2c7c1f upstream.

The ION AHCI device pretends that MSI masking isn't a thing, while it
actually implements it and needs MSIs to be unmasked to work. Add a quirk
to that effect.

Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Link: https://lore.kernel.org/r/CALjTZvbzYfBuLB+H=fj2J+9=DxjQ2Uqcy0if_PvmJ-nU-qEgkg@mail.gmail.com
Link: https://lore.kernel.org/r/20211104180130.3825416-3-maz@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/quirks.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5756,3 +5756,9 @@ static void apex_pci_fixup_class(struct
 }
 DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
 			       PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
+
+static void nvidia_ion_ahci_fixup(struct pci_dev *pdev)
+{
+	pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup);



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 17/21] erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 16/21] PCI: Add MSI masking quirk for Nvidia ION AHCI Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 18/21] erofs: fix unsafe pagevec reuse of hooked pclusters Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Yue Hu, Gao Xiang, Gao Xiang

From: Yue Hu <huyue2@yulong.com>

commit 7dea3de7d384f4c8156e8bd93112ba6db1eb276c upstream.

No any behavior to variable occupied in z_erofs_attach_page() which
is only caller to z_erofs_pagevec_enqueue().

Link: https://lore.kernel.org/r/20210419102623.2015-1-zbestahu@gmail.com
Signed-off-by: Yue Hu <huyue2@yulong.com>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/erofs/zdata.c |    4 +---
 fs/erofs/zpvec.h |    5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -282,7 +282,6 @@ static int z_erofs_attach_page(struct z_
 			       enum z_erofs_page_type type)
 {
 	int ret;
-	bool occupied;
 
 	/* give priority for inplaceio */
 	if (clt->mode >= COLLECT_PRIMARY &&
@@ -290,8 +289,7 @@ static int z_erofs_attach_page(struct z_
 	    z_erofs_try_inplace_io(clt, page))
 		return 0;
 
-	ret = z_erofs_pagevec_enqueue(&clt->vector,
-				      page, type, &occupied);
+	ret = z_erofs_pagevec_enqueue(&clt->vector, page, type);
 	clt->cl->vcnt += (unsigned int)ret;
 
 	return ret ? 0 : -EAGAIN;
--- a/fs/erofs/zpvec.h
+++ b/fs/erofs/zpvec.h
@@ -107,10 +107,8 @@ static inline void z_erofs_pagevec_ctor_
 
 static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor,
 					   struct page *page,
-					   enum z_erofs_page_type type,
-					   bool *occupied)
+					   enum z_erofs_page_type type)
 {
-	*occupied = false;
 	if (!ctor->next && type)
 		if (ctor->index + 1 == ctor->nr)
 			return false;
@@ -125,7 +123,6 @@ static inline bool z_erofs_pagevec_enque
 	/* should remind that collector->next never equal to 1, 2 */
 	if (type == (uintptr_t)ctor->next) {
 		ctor->next = page;
-		*occupied = true;
 	}
 	ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, page, type);
 	return true;



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 18/21] erofs: fix unsafe pagevec reuse of hooked pclusters
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 17/21] erofs: remove the occupied parameter from z_erofs_pagevec_enqueue() Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 19/21] scripts/lld-version.sh: Rewrite based on upstream ld-version.sh Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chao Yu, Gao Xiang

From: Gao Xiang <hsiangkao@linux.alibaba.com>

commit 86432a6dca9bed79111990851df5756d3eb5f57c upstream.

There are pclusters in runtime marked with Z_EROFS_PCLUSTER_TAIL
before actual I/O submission. Thus, the decompression chain can be
extended if the following pcluster chain hooks such tail pcluster.

As the related comment mentioned, if some page is made of a hooked
pcluster and another followed pcluster, it can be reused for in-place
I/O (since I/O should be submitted anyway):
 _______________________________________________________________
|  tail (partial) page |          head (partial) page           |
|_____PRIMARY_HOOKED___|____________PRIMARY_FOLLOWED____________|

However, it's by no means safe to reuse as pagevec since if such
PRIMARY_HOOKED pclusters finally move into bypass chain without I/O
submission. It's somewhat hard to reproduce with LZ4 and I just found
it (general protection fault) by ro_fsstressing a LZMA image for long
time.

I'm going to actively clean up related code together with multi-page
folio adaption in the next few months. Let's address it directly for
easier backporting for now.

Call trace for reference:
  z_erofs_decompress_pcluster+0x10a/0x8a0 [erofs]
  z_erofs_decompress_queue.isra.36+0x3c/0x60 [erofs]
  z_erofs_runqueue+0x5f3/0x840 [erofs]
  z_erofs_readahead+0x1e8/0x320 [erofs]
  read_pages+0x91/0x270
  page_cache_ra_unbounded+0x18b/0x240
  filemap_get_pages+0x10a/0x5f0
  filemap_read+0xa9/0x330
  new_sync_read+0x11b/0x1a0
  vfs_read+0xf1/0x190

Link: https://lore.kernel.org/r/20211103182006.4040-1-xiang@kernel.org
Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
Cc: <stable@vger.kernel.org> # 4.19+
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/erofs/zdata.c |   13 +++++++------
 fs/erofs/zpvec.h |   13 ++++++++++---
 2 files changed, 17 insertions(+), 9 deletions(-)

--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -278,8 +278,8 @@ static inline bool z_erofs_try_inplace_i
 
 /* callers must be with collection lock held */
 static int z_erofs_attach_page(struct z_erofs_collector *clt,
-			       struct page *page,
-			       enum z_erofs_page_type type)
+			       struct page *page, enum z_erofs_page_type type,
+			       bool pvec_safereuse)
 {
 	int ret;
 
@@ -289,9 +289,9 @@ static int z_erofs_attach_page(struct z_
 	    z_erofs_try_inplace_io(clt, page))
 		return 0;
 
-	ret = z_erofs_pagevec_enqueue(&clt->vector, page, type);
+	ret = z_erofs_pagevec_enqueue(&clt->vector, page, type,
+				      pvec_safereuse);
 	clt->cl->vcnt += (unsigned int)ret;
-
 	return ret ? 0 : -EAGAIN;
 }
 
@@ -645,7 +645,8 @@ hitted:
 		tight &= (clt->mode >= COLLECT_PRIMARY_FOLLOWED);
 
 retry:
-	err = z_erofs_attach_page(clt, page, page_type);
+	err = z_erofs_attach_page(clt, page, page_type,
+				  clt->mode >= COLLECT_PRIMARY_FOLLOWED);
 	/* should allocate an additional staging page for pagevec */
 	if (err == -EAGAIN) {
 		struct page *const newpage =
@@ -653,7 +654,7 @@ retry:
 
 		newpage->mapping = Z_EROFS_MAPPING_STAGING;
 		err = z_erofs_attach_page(clt, newpage,
-					  Z_EROFS_PAGE_TYPE_EXCLUSIVE);
+					  Z_EROFS_PAGE_TYPE_EXCLUSIVE, true);
 		if (!err)
 			goto retry;
 	}
--- a/fs/erofs/zpvec.h
+++ b/fs/erofs/zpvec.h
@@ -107,11 +107,18 @@ static inline void z_erofs_pagevec_ctor_
 
 static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor,
 					   struct page *page,
-					   enum z_erofs_page_type type)
+					   enum z_erofs_page_type type,
+					   bool pvec_safereuse)
 {
-	if (!ctor->next && type)
-		if (ctor->index + 1 == ctor->nr)
+	if (!ctor->next) {
+		/* some pages cannot be reused as pvec safely without I/O */
+		if (type == Z_EROFS_PAGE_TYPE_EXCLUSIVE && !pvec_safereuse)
+			type = Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED;
+
+		if (type != Z_EROFS_PAGE_TYPE_EXCLUSIVE &&
+		    ctor->index + 1 == ctor->nr)
 			return false;
+	}
 
 	if (ctor->index >= ctor->nr)
 		z_erofs_pagevec_ctor_pagedown(ctor, false);



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 19/21] scripts/lld-version.sh: Rewrite based on upstream ld-version.sh
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 18/21] erofs: fix unsafe pagevec reuse of hooked pclusters Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 20/21] perf/core: Avoid put_page() when GUP fails Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nathan Chancellor, Nick Desaulniers

From: Nathan Chancellor <nathan@kernel.org>

This patch is for linux-5.10.y only.

When scripts/lld-version.sh was initially written, it did not account
for the LLD_VENDOR cmake flag, which changes the output of ld.lld's
--version flag slightly.

Without LLD_VENDOR:

$ ld.lld --version
LLD 14.0.0 (compatible with GNU linkers)

With LLD_VENDOR:

$ ld.lld --version
Debian LLD 14.0.0 (compatible with GNU linkers)

As a result, CONFIG_LLD_VERSION is messed up and configuration values
that are dependent on it cannot be selected:

scripts/lld-version.sh: 20: printf: LLD: expected numeric value
scripts/lld-version.sh: 20: printf: LLD: expected numeric value
scripts/lld-version.sh: 20: printf: LLD: expected numeric value
init/Kconfig:52:warning: 'LLD_VERSION': number is invalid
.config:11:warning: symbol value '00000' invalid for LLD_VERSION
.config:8800:warning: override: CPU_BIG_ENDIAN changes choice state

This was fixed upstream by commit 1f09af062556 ("kbuild: Fix
ld-version.sh script if LLD was built with LLD_VENDOR") in 5.12 but that
was done to ld-version.sh after it was massively rewritten in
commit 02aff8592204 ("kbuild: check the minimum linker version in
Kconfig").

To avoid bringing in that change plus its prerequisites and fixes, just
modify lld-version.sh to make it similar to the upstream ld-version.sh,
which handles ld.lld with or without LLD_VENDOR and ld.bfd without any
errors.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/lld-version.sh |   35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

--- a/scripts/lld-version.sh
+++ b/scripts/lld-version.sh
@@ -6,15 +6,32 @@
 # Print the linker version of `ld.lld' in a 5 or 6-digit form
 # such as `100001' for ld.lld 10.0.1 etc.
 
-linker_string="$($* --version)"
+set -e
 
-if ! ( echo $linker_string | grep -q LLD ); then
+# Convert the version string x.y.z to a canonical 5 or 6-digit form.
+get_canonical_version()
+{
+	IFS=.
+	set -- $1
+
+	# If the 2nd or 3rd field is missing, fill it with a zero.
+	echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
+}
+
+# Get the first line of the --version output.
+IFS='
+'
+set -- $(LC_ALL=C "$@" --version)
+
+# Split the line on spaces.
+IFS=' '
+set -- $1
+
+while [ $# -gt 1 -a "$1" != "LLD" ]; do
+	shift
+done
+if [ "$1" = LLD ]; then
+	echo $(get_canonical_version ${2%-*})
+else
 	echo 0
-	exit 1
 fi
-
-VERSION=$(echo $linker_string | cut -d ' ' -f 2)
-MAJOR=$(echo $VERSION | cut -d . -f 1)
-MINOR=$(echo $VERSION | cut -d . -f 2)
-PATCHLEVEL=$(echo $VERSION | cut -d . -f 3)
-printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 20/21] perf/core: Avoid put_page() when GUP fails
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 19/21] scripts/lld-version.sh: Rewrite based on upstream ld-version.sh Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 17:37 ` [PATCH 5.10 21/21] thermal: Fix NULL pointer dereferences in of_thermal_ functions Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Greg Thelen, Peter Zijlstra (Intel)

From: Greg Thelen <gthelen@google.com>

commit 4716023a8f6a0f4a28047f14dd7ebdc319606b84 upstream.

PEBS PERF_SAMPLE_PHYS_ADDR events use perf_virt_to_phys() to convert PMU
sampled virtual addresses to physical using get_user_page_fast_only()
and page_to_phys().

Some get_user_page_fast_only() error cases return false, indicating no
page reference, but still initialize the output page pointer with an
unreferenced page. In these error cases perf_virt_to_phys() calls
put_page(). This causes page reference count underflow, which can lead
to unintentional page sharing.

Fix perf_virt_to_phys() to only put_page() if get_user_page_fast_only()
returns a referenced page.

Fixes: fc7ce9c74c3ad ("perf/core, x86: Add PERF_SAMPLE_PHYS_ADDR")
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211111021814.757086-1-gthelen@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/events/core.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7036,7 +7036,6 @@ void perf_output_sample(struct perf_outp
 static u64 perf_virt_to_phys(u64 virt)
 {
 	u64 phys_addr = 0;
-	struct page *p = NULL;
 
 	if (!virt)
 		return 0;
@@ -7055,14 +7054,15 @@ static u64 perf_virt_to_phys(u64 virt)
 		 * If failed, leave phys_addr as 0.
 		 */
 		if (current->mm != NULL) {
+			struct page *p;
+
 			pagefault_disable();
-			if (get_user_page_fast_only(virt, 0, &p))
+			if (get_user_page_fast_only(virt, 0, &p)) {
 				phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
+				put_page(p);
+			}
 			pagefault_enable();
 		}
-
-		if (p)
-			put_page(p);
 	}
 
 	return phys_addr;



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5.10 21/21] thermal: Fix NULL pointer dereferences in of_thermal_ functions
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 20/21] perf/core: Avoid put_page() when GUP fails Greg Kroah-Hartman
@ 2021-11-19 17:37 ` Greg Kroah-Hartman
  2021-11-19 18:46 ` [PATCH 5.10 00/21] 5.10.81-rc1 review Florian Fainelli
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 17:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Collins,
	Subbaraman Narayanamurthy, Daniel Lezcano, Rafael J. Wysocki

From: Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>

commit 96cfe05051fd8543cdedd6807ec59a0e6c409195 upstream.

of_parse_thermal_zones() parses the thermal-zones node and registers a
thermal_zone device for each subnode. However, if a thermal zone is
consuming a thermal sensor and that thermal sensor device hasn't probed
yet, an attempt to set trip_point_*_temp for that thermal zone device
can cause a NULL pointer dereference. Fix it.

 console:/sys/class/thermal/thermal_zone87 # echo 120000 > trip_point_0_temp
 ...
 Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
 ...
 Call trace:
  of_thermal_set_trip_temp+0x40/0xc4
  trip_point_temp_store+0xc0/0x1dc
  dev_attr_store+0x38/0x88
  sysfs_kf_write+0x64/0xc0
  kernfs_fop_write_iter+0x108/0x1d0
  vfs_write+0x2f4/0x368
  ksys_write+0x7c/0xec
  __arm64_sys_write+0x20/0x30
  el0_svc_common.llvm.7279915941325364641+0xbc/0x1bc
  do_el0_svc+0x28/0xa0
  el0_svc+0x14/0x24
  el0_sync_handler+0x88/0xec
  el0_sync+0x1c0/0x200

While at it, fix the possible NULL pointer dereference in other
functions as well: of_thermal_get_temp(), of_thermal_set_emul_temp(),
of_thermal_get_trend().

Suggested-by: David Collins <quic_collinsd@quicinc.com>
Signed-off-by: Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/thermal/thermal_of.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -89,7 +89,7 @@ static int of_thermal_get_temp(struct th
 {
 	struct __thermal_zone *data = tz->devdata;
 
-	if (!data->ops->get_temp)
+	if (!data->ops || !data->ops->get_temp)
 		return -EINVAL;
 
 	return data->ops->get_temp(data->sensor_data, temp);
@@ -186,6 +186,9 @@ static int of_thermal_set_emul_temp(stru
 {
 	struct __thermal_zone *data = tz->devdata;
 
+	if (!data->ops || !data->ops->set_emul_temp)
+		return -EINVAL;
+
 	return data->ops->set_emul_temp(data->sensor_data, temp);
 }
 
@@ -194,7 +197,7 @@ static int of_thermal_get_trend(struct t
 {
 	struct __thermal_zone *data = tz->devdata;
 
-	if (!data->ops->get_trend)
+	if (!data->ops || !data->ops->get_trend)
 		return -EINVAL;
 
 	return data->ops->get_trend(data->sensor_data, trip, trend);
@@ -301,7 +304,7 @@ static int of_thermal_set_trip_temp(stru
 	if (trip >= data->ntrips || trip < 0)
 		return -EDOM;
 
-	if (data->ops->set_trip_temp) {
+	if (data->ops && data->ops->set_trip_temp) {
 		int ret;
 
 		ret = data->ops->set_trip_temp(data->sensor_data, trip, temp);



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2021-11-19 17:37 ` [PATCH 5.10 21/21] thermal: Fix NULL pointer dereferences in of_thermal_ functions Greg Kroah-Hartman
@ 2021-11-19 18:46 ` Florian Fainelli
  2021-11-19 19:46 ` Fox Chen
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Florian Fainelli @ 2021-11-19 18:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, stable

On 11/19/21 9:37 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:

Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2021-11-19 18:46 ` [PATCH 5.10 00/21] 5.10.81-rc1 review Florian Fainelli
@ 2021-11-19 19:46 ` Fox Chen
  2021-11-20  0:49 ` Shuah Khan
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Fox Chen @ 2021-11-19 19:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, stable, Fox Chen

On Fri, 19 Nov 2021 18:37:35 +0100, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

5.10.81-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
                
Tested-by: Fox Chen <foxhlchen@gmail.com>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate block size
  2021-11-19 17:37 ` [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate " Greg Kroah-Hartman
@ 2021-11-19 21:45   ` Pavel Machek
  2021-11-20  7:39     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Pavel Machek @ 2021-11-19 21:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, Xie Yongji, Jens Axboe, Tadeusz Struk

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Hi!

> commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream.
> 
> Remove loop_validate_block_size() and use the block layer helper
> to validate block size.

This is just a cleanup, and it needs previous cleanup to be
applied. I would not mind if both were dropped from stable series.

Best regards,
								Pavel

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper
  2021-11-19 17:37 ` [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper Greg Kroah-Hartman
@ 2021-11-19 21:47   ` Pavel Machek
  2021-11-19 22:24     ` Nick Desaulniers
  0 siblings, 1 reply; 39+ messages in thread
From: Pavel Machek @ 2021-11-19 21:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, Lucas Henneman, Masahiro Yamada,
	Nick Desaulniers, Vincenzo Frascino, Nathan Chancellor,
	Will Deacon

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

Hi!

> commit 14831fad73f5ac30ac61760487d95a538e6ab3cb upstream.
> 
> When running the following command without arm-linux-gnueabi-gcc in
> one's $PATH, the following warning is observed:
> 
> $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> make[1]: arm-linux-gnueabi-gcc: No such file or directory
> 
> This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> is not set, and we end up eagerly evaluating various variables that try
> to invoke CC_COMPAT.

Upstream commit is fine, but 5.10 port misses the 2> part of the
change.

> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -48,7 +48,8 @@ cc32-as-instr = $(call try-run,\
>  # As a result we set our own flags here.
>  
>  # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
> -VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> +VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc
> +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include)
>  VDSO_CPPFLAGS += $(LINUXINCLUDE)
>  
>  # Common C and assembly flags
>

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper
  2021-11-19 21:47   ` Pavel Machek
@ 2021-11-19 22:24     ` Nick Desaulniers
  2021-11-19 22:30       ` Nick Desaulniers
  2021-11-21  7:48       ` Greg Kroah-Hartman
  0 siblings, 2 replies; 39+ messages in thread
From: Nick Desaulniers @ 2021-11-19 22:24 UTC (permalink / raw)
  To: Pavel Machek, Greg Kroah-Hartman
  Cc: linux-kernel, stable, Lucas Henneman, Masahiro Yamada,
	Vincenzo Frascino, Nathan Chancellor, Will Deacon

On Fri, Nov 19, 2021 at 1:47 PM Pavel Machek <pavel@denx.de> wrote:
>
> Hi!
>
> > commit 14831fad73f5ac30ac61760487d95a538e6ab3cb upstream.
> >
> > When running the following command without arm-linux-gnueabi-gcc in
> > one's $PATH, the following warning is observed:
> >
> > $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> > make[1]: arm-linux-gnueabi-gcc: No such file or directory
> >
> > This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> > is not set, and we end up eagerly evaluating various variables that try
> > to invoke CC_COMPAT.
>
> Upstream commit is fine, but 5.10 port misses the 2> part of the
> change.

You're right; thanks for the report. Greg, can you drop this version
of the backport for 5.10 and 5.4? I'll resubmit an updated version.

>
> > +++ b/arch/arm64/kernel/vdso32/Makefile
> > @@ -48,7 +48,8 @@ cc32-as-instr = $(call try-run,\
> >  # As a result we set our own flags here.
> >
> >  # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
> > -VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> > +VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc
> > +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> >  VDSO_CPPFLAGS += $(LINUXINCLUDE)
> >
> >  # Common C and assembly flags
> >
>
> Best regards,
>                                                                 Pavel
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper
  2021-11-19 22:24     ` Nick Desaulniers
@ 2021-11-19 22:30       ` Nick Desaulniers
  2021-11-21  7:48       ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Nick Desaulniers @ 2021-11-19 22:30 UTC (permalink / raw)
  To: Pavel Machek, Greg Kroah-Hartman
  Cc: linux-kernel, stable, Lucas Henneman, Masahiro Yamada,
	Vincenzo Frascino, Nathan Chancellor, Will Deacon

On Fri, Nov 19, 2021 at 2:24 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Nov 19, 2021 at 1:47 PM Pavel Machek <pavel@denx.de> wrote:
> >
> > Hi!
> >
> > > commit 14831fad73f5ac30ac61760487d95a538e6ab3cb upstream.
> > >
> > > When running the following command without arm-linux-gnueabi-gcc in
> > > one's $PATH, the following warning is observed:
> > >
> > > $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> > > make[1]: arm-linux-gnueabi-gcc: No such file or directory
> > >
> > > This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> > > is not set, and we end up eagerly evaluating various variables that try
> > > to invoke CC_COMPAT.
> >
> > Upstream commit is fine, but 5.10 port misses the 2> part of the
> > change.
>
> You're right; thanks for the report. Greg, can you drop this version
> of the backport for 5.10 and 5.4? I'll resubmit an updated version.

V2 sent:
https://lore.kernel.org/stable/CAKwvOdkZ1ydLs2VwvVLtT7QK+e1gNB0ZE5RqTxMY15QQvhxZ1w@mail.gmail.com/

>
> >
> > > +++ b/arch/arm64/kernel/vdso32/Makefile
> > > @@ -48,7 +48,8 @@ cc32-as-instr = $(call try-run,\
> > >  # As a result we set our own flags here.
> > >
> > >  # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
> > > -VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> > > +VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc
> > > +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> > >  VDSO_CPPFLAGS += $(LINUXINCLUDE)
> > >
> > >  # Common C and assembly flags
> > >
> >
> > Best regards,
> >                                                                 Pavel
> > --
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2021-11-19 19:46 ` Fox Chen
@ 2021-11-20  0:49 ` Shuah Khan
  2021-11-20  7:28 ` Pavel Machek
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Shuah Khan @ 2021-11-20  0:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable, Shuah Khan

On 11/19/21 10:37 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

Tested-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2021-11-20  0:49 ` Shuah Khan
@ 2021-11-20  7:28 ` Pavel Machek
  2021-11-20 15:21 ` Sudip Mukherjee
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Pavel Machek @ 2021-11-20  7:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Hi!

> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

CIP testing did not find any problems here:

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y

Tested-by: Pavel Machek (CIP) <pavel@denx.de>

Best regards,
                                                                Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate block size
  2021-11-19 21:45   ` Pavel Machek
@ 2021-11-20  7:39     ` Greg Kroah-Hartman
  2021-11-21 16:59       ` Pavel Machek
  0 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-20  7:39 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, stable, Xie Yongji, Jens Axboe, Tadeusz Struk

On Fri, Nov 19, 2021 at 10:45:22PM +0100, Pavel Machek wrote:
> Hi!
> 
> > commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream.
> > 
> > Remove loop_validate_block_size() and use the block layer helper
> > to validate block size.
> 
> This is just a cleanup, and it needs previous cleanup to be
> applied. I would not mind if both were dropped from stable series.

No, it is not a cleanup, it fixes a real bug as reported on the stable
mailing list.

greg k-h

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2021-11-20  7:28 ` Pavel Machek
@ 2021-11-20 15:21 ` Sudip Mukherjee
  2021-11-20 15:27 ` Daniel Díaz
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 39+ messages in thread
From: Sudip Mukherjee @ 2021-11-20 15:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, f.fainelli, stable

Hi Greg,

On Fri, Nov 19, 2021 at 06:37:35PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.

Build test:
mips (gcc version 11.2.1 20211112): 63 configs -> no new failure
arm (gcc version 11.2.1 20211112): 105 configs -> no new failure
arm64 (gcc version 11.2.1 20211112): 3 configs -> no failure
x86_64 (gcc version 11.2.1 20211112): 4 configs -> no failure

Boot test:
x86_64: Booted on my test laptop. No regression.
x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]

[1]. https://openqa.qa.codethink.co.uk/tests/410
[2]. https://openqa.qa.codethink.co.uk/tests/409


Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

--
Regards
Sudip


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2021-11-20 15:21 ` Sudip Mukherjee
@ 2021-11-20 15:27 ` Daniel Díaz
  2021-11-20 16:06   ` Naresh Kamboju
  2021-11-20 16:52 ` Guenter Roeck
  2021-11-22  2:48 ` Samuel Zou
  28 siblings, 1 reply; 39+ messages in thread
From: Daniel Díaz @ 2021-11-20 15:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

Hello!

On 11/19/21 11:37 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 
> -------------
> Pseudo-Shortlog of commits:
> 
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>      Linux 5.10.81-rc1
[...]> Peter Zijlstra <peterz@infradead.org>
>      x86/iopl: Fake iopl(3) CLI/STI usage
[...]

Results from Linaro's test farm.
Regressions found on x86_64 and i386, on iopl. Here's an excerpt of the selftest:

   [    0.000000] Linux version 5.10.81-rc1 (oe-user@oe-host) (x86_64-linaro-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 SMP Fri Nov 19 19:48:55 UTC 2021
[...]
   [  170.351838] traps: iopl_64[2769] attempts to use CLI/STI, pretending it's a NOP, ip:400dde in iopl_64[400000+2000]
[...]
   # selftests: x86: iopl_64
   # [FAIL]	CLI worked
   # [FAIL]	STI worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0xed failed
   # 	child: set IOPL to 3
   # [RUN]	child: write to 0x80
   # [FAIL]	CLI worked
   # [FAIL]	STI worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0xed failed
   # [OK]	Child succeeded
   # [RUN]	parent: write to 0x80 (should fail)
   # [OK]	outb to 0x80 failed
   # [OK]	CLI faulted
   # [OK]	STI faulted
   # 	iopl(3)
   # 	Drop privileges
   # [RUN]	iopl(3) unprivileged but with IOPL==3
   # [RUN]	iopl(0) unprivileged
   # [RUN]	iopl(3) unprivileged
   # [OK]	Failed as expected
   not ok 7 selftests: x86: iopl_64 # exit=1

The baseline kernel (v5.10.80) exhibited this output:
   # selftests: x86: iopl_64
   # [OK]	CLI faulted
   # [OK]	STI faulted
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0xed failed
   # 	child: set IOPL to 3
   # [RUN]	child: write to 0x80
   # [OK]	CLI faulted
   # [OK]	STI faulted
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0x80 worked
   # [OK]	outb to 0xed failed
   # [OK]	Child succeeded
   # [RUN]	parent: write to 0x80 (should fail)
   # [OK]	outb to 0x80 failed
   # [OK]	CLI faulted
   # [OK]	STI faulted
   # 	iopl(3)
   # 	Drop privileges
   # [RUN]	iopl(3) unprivileged but with IOPL==3
   # [RUN]	iopl(0) unprivileged
   # [RUN]	iopl(3) unprivileged
   # [OK]	Failed as expected
   ok 7 selftests: x86: iopl_64


## Build
* kernel: 5.10.81-rc1
* git: ['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git', 'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
* git branch: linux-5.10.y
* git commit: ed689bd1df46a07911fffa509cd06c5ec7beb9c1
* git describe: v5.10.80-22-ged689bd1df46
* test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.80-22-ged689bd1df46

## Regressions (compared to v5.10.80)
* i386, kselftest-x86
   - x86.iopl_32

* qemu_x86_64, kselftest-x86
   - x86.iopl_64

* x86, kselftest-x86
   - x86.iopl_64

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>


## No fixes (compared to v5.10.80)

## Test result summary
total: 91125, pass: 77560, fail: 574, skip: 12243, xfail: 748

## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 259 total, 259 passed, 0 failed
* arm64: 37 total, 37 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 36 total, 36 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 34 total, 34 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 54 total, 46 passed, 8 failed
* riscv: 24 total, 24 passed, 0 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 37 total, 37 passed, 0 failed

## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance


Greetings!

Daniel Díaz
daniel.diaz@linaro.org

-- 
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-20 15:27 ` Daniel Díaz
@ 2021-11-20 16:06   ` Naresh Kamboju
  2021-11-21  7:49     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Naresh Kamboju @ 2021-11-20 16:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Peter Zijlstra, Thomas Gleixner, Borislav Petkov
  Cc: linux-kernel, f.fainelli, torvalds, patches, lkft-triage,
	jonathanh, stable, pavel, akpm, shuah, linux, Daniel Díaz,
	Ondrej Zary

+ Peter Zijlstra
+ Thomas Gleixner
+ Borislav Petkov
+ Ondrej Zary


On Sat, 20 Nov 2021 at 20:57, Daniel Díaz <daniel.diaz@linaro.org> wrote:
>
> Hello!
>
> On 11/19/21 11:37 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.10.81 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> >       https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> > or in the git tree and branch at:
> >       git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> >
> > -------------
> > Pseudo-Shortlog of commits:
> >
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >      Linux 5.10.81-rc1
> [...]> Peter Zijlstra <peterz@infradead.org>
> >      x86/iopl: Fake iopl(3) CLI/STI usage

This is due to  ^ new kernel code + old test case (Test case needs to
be updated)

> [...]
>
> Results from Linaro's test farm.
> Regressions found on x86_64 and i386, on iopl. Here's an excerpt of the selftest:
>
>    [    0.000000] Linux version 5.10.81-rc1 (oe-user@oe-host) (x86_64-linaro-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 SMP Fri Nov 19 19:48:55 UTC 2021
> [...]
>    [  170.351838] traps: iopl_64[2769] attempts to use CLI/STI, pretending it's a NOP, ip:400dde in iopl_64[400000+2000]
> [...]
>    # selftests: x86: iopl_64
>    # [FAIL]     CLI worked
>    # [FAIL]     STI worked

This failure was detected on linux next and the later test case has been fixed.
The Following patch could fix this problem across 5.10, 5.14 and 5.15.

Patch details,
---
selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage

Commit in Fixes changed the iopl emulation to not #GP on CLI and STI
because it would break some insane luserspace tools which would toggle
interrupts.

The corresponding selftest would rely on the fact that executing CLI/STI
would trigger a #GP and thus detect it this way but since that #GP is
not happening anymore, the detection is now wrong too.

Extend the test to actually look at the IF flag and whether executing
those insns had any effect on it. The STI detection needs to have the
fact that interrupts were previously disabled, passed in so do that from
the previous CLI test, i.e., STI test needs to follow a previous CLI one
for it to make sense.

Fixes: b968e84b509d ("x86/iopl: Fake iopl(3) CLI/STI usage")
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20211030083939.13073-1-bp@alien8.de



>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0xed failed
>    #    child: set IOPL to 3
>    # [RUN]      child: write to 0x80
>    # [FAIL]     CLI worked
>    # [FAIL]     STI worked
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0xed failed
>    # [OK]       Child succeeded
>    # [RUN]      parent: write to 0x80 (should fail)
>    # [OK]       outb to 0x80 failed
>    # [OK]       CLI faulted
>    # [OK]       STI faulted
>    #    iopl(3)
>    #    Drop privileges
>    # [RUN]      iopl(3) unprivileged but with IOPL==3
>    # [RUN]      iopl(0) unprivileged
>    # [RUN]      iopl(3) unprivileged
>    # [OK]       Failed as expected
>    not ok 7 selftests: x86: iopl_64 # exit=1
>
> The baseline kernel (v5.10.80) exhibited this output:
>    # selftests: x86: iopl_64
>    # [OK]       CLI faulted
>    # [OK]       STI faulted
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0xed failed
>    #    child: set IOPL to 3
>    # [RUN]      child: write to 0x80
>    # [OK]       CLI faulted
>    # [OK]       STI faulted
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0x80 worked
>    # [OK]       outb to 0xed failed
>    # [OK]       Child succeeded
>    # [RUN]      parent: write to 0x80 (should fail)
>    # [OK]       outb to 0x80 failed
>    # [OK]       CLI faulted
>    # [OK]       STI faulted
>    #    iopl(3)
>    #    Drop privileges
>    # [RUN]      iopl(3) unprivileged but with IOPL==3
>    # [RUN]      iopl(0) unprivileged
>    # [RUN]      iopl(3) unprivileged
>    # [OK]       Failed as expected
>    ok 7 selftests: x86: iopl_64
>
>
> ## Build
> * kernel: 5.10.81-rc1
> * git: ['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git', 'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
> * git branch: linux-5.10.y
> * git commit: ed689bd1df46a07911fffa509cd06c5ec7beb9c1
> * git describe: v5.10.80-22-ged689bd1df46
> * test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.80-22-ged689bd1df46
>
> ## Regressions (compared to v5.10.80)
> * i386, kselftest-x86
>    - x86.iopl_32
>
> * qemu_x86_64, kselftest-x86
>    - x86.iopl_64
>
> * x86, kselftest-x86
>    - x86.iopl_64
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>
>
> ## No fixes (compared to v5.10.80)
>
> ## Test result summary
> total: 91125, pass: 77560, fail: 574, skip: 12243, xfail: 748
>
> ## Build Summary
> * arc: 10 total, 10 passed, 0 failed
> * arm: 259 total, 259 passed, 0 failed
> * arm64: 37 total, 37 passed, 0 failed
> * dragonboard-410c: 1 total, 1 passed, 0 failed
> * hi6220-hikey: 1 total, 1 passed, 0 failed
> * i386: 36 total, 36 passed, 0 failed
> * juno-r2: 1 total, 1 passed, 0 failed
> * mips: 34 total, 34 passed, 0 failed
> * parisc: 12 total, 12 passed, 0 failed
> * powerpc: 54 total, 46 passed, 8 failed
> * riscv: 24 total, 24 passed, 0 failed
> * s390: 18 total, 18 passed, 0 failed
> * sh: 24 total, 24 passed, 0 failed
> * sparc: 12 total, 12 passed, 0 failed
> * x15: 1 total, 1 passed, 0 failed
> * x86: 1 total, 1 passed, 0 failed
> * x86_64: 37 total, 37 passed, 0 failed
>
> ## Test suites summary
> * fwts
> * igt-gpu-tools
> * kselftest-android
> * kselftest-bpf
> * kselftest-breakpoints
> * kselftest-capabilities
> * kselftest-cgroup
> * kselftest-clone3
> * kselftest-core
> * kselftest-cpu-hotplug
> * kselftest-cpufreq
> * kselftest-drivers
> * kselftest-efivarfs
> * kselftest-filesystems
> * kselftest-firmware
> * kselftest-fpu
> * kselftest-futex
> * kselftest-gpio
> * kselftest-intel_pstate
> * kselftest-ipc
> * kselftest-ir
> * kselftest-kcmp
> * kselftest-kexec
> * kselftest-kvm
> * kselftest-lib
> * kselftest-livepatch
> * kselftest-membarrier
> * kselftest-memfd
> * kselftest-memory-hotplug
> * kselftest-mincore
> * kselftest-mount
> * kselftest-mqueue
> * kselftest-net
> * kselftest-netfilter
> * kselftest-nsfs
> * kselftest-openat2
> * kselftest-pid_namespace
> * kselftest-pidfd
> * kselftest-proc
> * kselftest-pstore
> * kselftest-ptrace
> * kselftest-rseq
> * kselftest-rtc
> * kselftest-seccomp
> * kselftest-sigaltstack
> * kselftest-size
> * kselftest-splice
> * kselftest-static_keys
> * kselftest-sync
> * kselftest-sysctl
> * kselftest-tc-testing
> * kselftest-timens
> * kselftest-timers
> * kselftest-tmpfs
> * kselftest-tpm2
> * kselftest-user
> * kselftest-vm
> * kselftest-x86
> * kselftest-zram
> * kunit
> * kvm-unit-tests
> * libgpiod
> * libhugetlbfs
> * linux-log-parser
> * ltp-cap_bounds-tests
> * ltp-commands-tests
> * ltp-containers-tests
> * ltp-controllers-tests
> * ltp-cpuhotplug-tests
> * ltp-crypto-tests
> * ltp-cve-tests
> * ltp-dio-tests
> * ltp-fcntl-locktests-tests
> * ltp-filecaps-tests
> * ltp-fs-tests
> * ltp-fs_bind-tests
> * ltp-fs_perms_simple-tests
> * ltp-fsx-tests
> * ltp-hugetlb-tests
> * ltp-io-tests
> * ltp-ipc-tests
> * ltp-math-tests
> * ltp-mm-tests
> * ltp-nptl-tests
> * ltp-open-posix-tests
> * ltp-pty-tests
> * ltp-sched-tests
> * ltp-securebits-tests
> * ltp-syscalls-tests
> * ltp-tracing-tests
> * network-basic-tests
> * packetdrill
> * perf
> * rcutorture
> * ssuite
> * v4l2-compliance
>
>
> Greetings!
>
> Daniel Díaz
> daniel.diaz@linaro.org
>
> --
> Linaro LKFT
> https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2021-11-20 15:27 ` Daniel Díaz
@ 2021-11-20 16:52 ` Guenter Roeck
  2021-11-22  2:48 ` Samuel Zou
  28 siblings, 0 replies; 39+ messages in thread
From: Guenter Roeck @ 2021-11-20 16:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable

On Fri, Nov 19, 2021 at 06:37:35PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 

Build results:
	total: 159 pass: 159 fail: 0
Qemu test results:
	total: 474 pass: 474 fail: 0

Tested-by: Guenter Roeck <linux@roeck-us.net>

Guenter

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper
  2021-11-19 22:24     ` Nick Desaulniers
  2021-11-19 22:30       ` Nick Desaulniers
@ 2021-11-21  7:48       ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-21  7:48 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Pavel Machek, linux-kernel, stable, Lucas Henneman,
	Masahiro Yamada, Vincenzo Frascino, Nathan Chancellor,
	Will Deacon

On Fri, Nov 19, 2021 at 02:24:09PM -0800, Nick Desaulniers wrote:
> On Fri, Nov 19, 2021 at 1:47 PM Pavel Machek <pavel@denx.de> wrote:
> >
> > Hi!
> >
> > > commit 14831fad73f5ac30ac61760487d95a538e6ab3cb upstream.
> > >
> > > When running the following command without arm-linux-gnueabi-gcc in
> > > one's $PATH, the following warning is observed:
> > >
> > > $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> > > make[1]: arm-linux-gnueabi-gcc: No such file or directory
> > >
> > > This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> > > is not set, and we end up eagerly evaluating various variables that try
> > > to invoke CC_COMPAT.
> >
> > Upstream commit is fine, but 5.10 port misses the 2> part of the
> > change.
> 
> You're right; thanks for the report. Greg, can you drop this version
> of the backport for 5.10 and 5.4? I'll resubmit an updated version.

Now dropped, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-20 16:06   ` Naresh Kamboju
@ 2021-11-21  7:49     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-21  7:49 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Peter Zijlstra, Thomas Gleixner, Borislav Petkov, linux-kernel,
	f.fainelli, torvalds, patches, lkft-triage, jonathanh, stable,
	pavel, akpm, shuah, linux, Daniel Díaz, Ondrej Zary

On Sat, Nov 20, 2021 at 09:36:55PM +0530, Naresh Kamboju wrote:
> + Peter Zijlstra
> + Thomas Gleixner
> + Borislav Petkov
> + Ondrej Zary
> 
> 
> On Sat, 20 Nov 2021 at 20:57, Daniel Díaz <daniel.diaz@linaro.org> wrote:
> >
> > Hello!
> >
> > On 11/19/21 11:37 AM, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 5.10.81 release.
> > > There are 21 patches in this series, all will be posted as a response
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> > > Anything received after that time might be too late.
> > >
> > > The whole patch series can be found in one patch at:
> > >       https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> > > or in the git tree and branch at:
> > >       git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> > > and the diffstat can be found below.
> > >
> > > thanks,
> > >
> > > greg k-h
> > >
> > > -------------
> > > Pseudo-Shortlog of commits:
> > >
> > > Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >      Linux 5.10.81-rc1
> > [...]> Peter Zijlstra <peterz@infradead.org>
> > >      x86/iopl: Fake iopl(3) CLI/STI usage
> 
> This is due to  ^ new kernel code + old test case (Test case needs to
> be updated)
> 
> > [...]
> >
> > Results from Linaro's test farm.
> > Regressions found on x86_64 and i386, on iopl. Here's an excerpt of the selftest:
> >
> >    [    0.000000] Linux version 5.10.81-rc1 (oe-user@oe-host) (x86_64-linaro-linux-gcc (GCC) 7.3.0, GNU ld (GNU Binutils) 2.30.0.20180208) #1 SMP Fri Nov 19 19:48:55 UTC 2021
> > [...]
> >    [  170.351838] traps: iopl_64[2769] attempts to use CLI/STI, pretending it's a NOP, ip:400dde in iopl_64[400000+2000]
> > [...]
> >    # selftests: x86: iopl_64
> >    # [FAIL]     CLI worked
> >    # [FAIL]     STI worked
> 
> This failure was detected on linux next and the later test case has been fixed.
> The Following patch could fix this problem across 5.10, 5.14 and 5.15.
> 
> Patch details,
> ---
> selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage
> 
> Commit in Fixes changed the iopl emulation to not #GP on CLI and STI
> because it would break some insane luserspace tools which would toggle
> interrupts.
> 
> The corresponding selftest would rely on the fact that executing CLI/STI
> would trigger a #GP and thus detect it this way but since that #GP is
> not happening anymore, the detection is now wrong too.
> 
> Extend the test to actually look at the IF flag and whether executing
> those insns had any effect on it. The STI detection needs to have the
> fact that interrupts were previously disabled, passed in so do that from
> the previous CLI test, i.e., STI test needs to follow a previous CLI one
> for it to make sense.
> 
> Fixes: b968e84b509d ("x86/iopl: Fake iopl(3) CLI/STI usage")
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lore.kernel.org/r/20211030083939.13073-1-bp@alien8.de

Now queued up, thanks,

greg k-h

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate block size
  2021-11-20  7:39     ` Greg Kroah-Hartman
@ 2021-11-21 16:59       ` Pavel Machek
  0 siblings, 0 replies; 39+ messages in thread
From: Pavel Machek @ 2021-11-21 16:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Pavel Machek, linux-kernel, stable, Xie Yongji, Jens Axboe,
	Tadeusz Struk

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

On Sat 2021-11-20 08:39:48, Greg Kroah-Hartman wrote:
> On Fri, Nov 19, 2021 at 10:45:22PM +0100, Pavel Machek wrote:
> > Hi!
> > 
> > > commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream.
> > > 
> > > Remove loop_validate_block_size() and use the block layer helper
> > > to validate block size.
> > 
> > This is just a cleanup, and it needs previous cleanup to be
> > applied. I would not mind if both were dropped from stable series.
> 
> No, it is not a cleanup, it fixes a real bug as reported on the stable
> mailing list.

Aha:
https://lore.kernel.org/all/7e6c4c23-f071-f33b-7bd4-da11980d34c6@linaro.org/

Thanks for explanation.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5.10 00/21] 5.10.81-rc1 review
  2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2021-11-20 16:52 ` Guenter Roeck
@ 2021-11-22  2:48 ` Samuel Zou
  28 siblings, 0 replies; 39+ messages in thread
From: Samuel Zou @ 2021-11-22  2:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, f.fainelli, stable



On 2021/11/20 1:37, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 5.10.81 release.
> There are 21 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sun, 21 Nov 2021 17:14:35 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.81-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Tested on arm64 and x86 for 5.10.81-rc1,

Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Branch: linux-5.10.y
Version: 5.10.81-rc1
Commit: ed689bd1df46a07911fffa509cd06c5ec7beb9c1
Compiler: gcc version 7.3.0 (GCC)

arm64:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9019
passed: 9019
failed: 0
timeout: 0
--------------------------------------------------------------------

x86:
--------------------------------------------------------------------
Testcase Result Summary:
total: 9019
passed: 9019
failed: 0
timeout: 0
--------------------------------------------------------------------

Tested-by: Hulk Robot <hulkrobot@huawei.com>

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2021-11-22  2:49 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 17:37 [PATCH 5.10 00/21] 5.10.81-rc1 review Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 01/21] fortify: Explicitly disable Clang support Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 02/21] block: Add a helper to validate the block size Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate " Greg Kroah-Hartman
2021-11-19 21:45   ` Pavel Machek
2021-11-20  7:39     ` Greg Kroah-Hartman
2021-11-21 16:59       ` Pavel Machek
2021-11-19 17:37 ` [PATCH 5.10 04/21] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 05/21] net: stmmac: add clocks management for gmac driver Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 06/21] net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 07/21] net: stmmac: fix missing unlock on error in stmmac_suspend() Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 08/21] net: stmmac: fix system hang if change mac address after interface ifdown Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 09/21] net: stmmac: fix issue where clk is being unprepared twice Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 10/21] net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 11/21] arm64: vdso32: suppress error message for make mrproper Greg Kroah-Hartman
2021-11-19 21:47   ` Pavel Machek
2021-11-19 22:24     ` Nick Desaulniers
2021-11-19 22:30       ` Nick Desaulniers
2021-11-21  7:48       ` Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 12/21] x86/iopl: Fake iopl(3) CLI/STI usage Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 13/21] parisc/entry: fix trace test in syscall exit path Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 14/21] PCI/MSI: Destroy sysfs before freeing entries Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 15/21] PCI/MSI: Deal with devices lying about their MSI mask capability Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 16/21] PCI: Add MSI masking quirk for Nvidia ION AHCI Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 17/21] erofs: remove the occupied parameter from z_erofs_pagevec_enqueue() Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 18/21] erofs: fix unsafe pagevec reuse of hooked pclusters Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 19/21] scripts/lld-version.sh: Rewrite based on upstream ld-version.sh Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 20/21] perf/core: Avoid put_page() when GUP fails Greg Kroah-Hartman
2021-11-19 17:37 ` [PATCH 5.10 21/21] thermal: Fix NULL pointer dereferences in of_thermal_ functions Greg Kroah-Hartman
2021-11-19 18:46 ` [PATCH 5.10 00/21] 5.10.81-rc1 review Florian Fainelli
2021-11-19 19:46 ` Fox Chen
2021-11-20  0:49 ` Shuah Khan
2021-11-20  7:28 ` Pavel Machek
2021-11-20 15:21 ` Sudip Mukherjee
2021-11-20 15:27 ` Daniel Díaz
2021-11-20 16:06   ` Naresh Kamboju
2021-11-21  7:49     ` Greg Kroah-Hartman
2021-11-20 16:52 ` Guenter Roeck
2021-11-22  2:48 ` Samuel Zou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).