From e6d2919c9acb2989d237845ea920f9768947d405 Mon Sep 17 00:00:00 2001 From: Michal Kubecek Date: Jul 05 2021 23:34:35 +0000 Subject: Merge branches 'users/bpetkov/SLE15-SP2/for-next', 'users/dwagner/SLE15-SP2/for-next', 'users/lduncan/SLE15-SP2/for-next', 'users/lhenriques/SLE15-SP2/for-next' and 'users/mkoutny/SLE15-SP2/for-next' into SLE15-SP2 Pull x86 fixes from Borislav Petkov. Pull a scsi fix from Daniel Wagner. Pull a scsi fix from Lee Duncan. Pull a ceph fix from Luis Henriques. Pull a cgroup fix from Michal Koutný. --- diff --git a/blacklist.conf b/blacklist.conf index 457df44..2bfe505 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -641,3 +641,6 @@ feb18e900f0048001ff375dca639eaa327ab3c1b # requires c2d0f1a65ab9fbabebb463bf36f5 5ce7902902adb8d154d67ba494f06daa29360ef0 # requires c2d0f1a65ab9fbabebb463bf36f50ea8f4633386 71dca5539fcf977aead0c9ea1962e70e78484b8e # requires c2d0f1a65ab9fbabebb463bf36f50ea8f4633386 4b42d557a8add52b9a9924fb31e40a218aab7801 # way too invasive, context all wrong +d8778e393afa421f1f117471144f8ce6deb6953a # Fixes: tag for that patch is wrong, it should be 98265c17efa9 which is 5.7 +89f5f8fb5bf4305a5425f70abf3c0d93643c93dc # just a cleanup +1e886090cefe26113122a7d59a36a9aec492fef5 # documentation diff --git a/patches.suse/ceph-must-hold-snap_rwsem-when-filling-inode-for-async-create.patch b/patches.suse/ceph-must-hold-snap_rwsem-when-filling-inode-for-async-create.patch new file mode 100644 index 0000000..cc079b6 --- /dev/null +++ b/patches.suse/ceph-must-hold-snap_rwsem-when-filling-inode-for-async-create.patch @@ -0,0 +1,55 @@ +From: Jeff Layton +Date: Tue, 1 Jun 2021 09:40:25 -0400 +Subject: ceph: must hold snap_rwsem when filling inode for async create +Git-commit: 27171ae6a0fdc75571e5bf3d0961631a1e4fb765 +Patch-mainline: v5.13 +References: bsc#1187927 + +...and add a lockdep assertion for it to ceph_fill_inode(). + +Cc: stable@vger.kernel.org # v5.7+ +Fixes: 9a8d03ca2e2c3 ("ceph: attempt to do async create when possible") +Signed-off-by: Jeff Layton +Reviewed-by: Ilya Dryomov +Signed-off-by: Ilya Dryomov +[luis: inlined ceph_sb_to_mdsc() helper, as we don't have commit + 2678da88f4b4 ] +Acked-by: Luis Henriques +--- + fs/ceph/file.c | 3 +++ + fs/ceph/inode.c | 2 ++ + 2 files changed, 5 insertions(+) + +--- a/fs/ceph/file.c ++++ b/fs/ceph/file.c +@@ -579,6 +579,7 @@ static int ceph_finish_async_create(stru + struct ceph_inode_info *ci = ceph_inode(dir); + struct inode *inode; + struct timespec64 now; ++ struct ceph_mds_client *mdsc = ceph_sb_to_client(dir->i_sb)->mdsc; + struct ceph_vino vino = { .ino = req->r_deleg_ino, + .snap = CEPH_NOSNAP }; + +@@ -616,8 +617,10 @@ static int ceph_finish_async_create(stru + + ceph_file_layout_to_legacy(lo, &in.layout); + ++ down_read(&mdsc->snap_rwsem); + ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session, + req->r_fmode, NULL); ++ up_read(&mdsc->snap_rwsem); + if (ret) { + dout("%s failed to fill inode: %d\n", __func__, ret); + ceph_dir_clear_complete(dir); +--- a/fs/ceph/inode.c ++++ b/fs/ceph/inode.c +@@ -768,6 +768,8 @@ int ceph_fill_inode(struct inode *inode, + bool new_version = false; + bool fill_inline = false; + ++ lockdep_assert_held(&mdsc->snap_rwsem); ++ + dout("%s %p ino %llx.%llx v %llu had %llu\n", __func__, + inode, ceph_vinop(inode), le64_to_cpu(info->version), + ci->i_version); + diff --git a/patches.suse/cgroup1-don-t-allow-n-in-renaming.patch b/patches.suse/cgroup1-don-t-allow-n-in-renaming.patch new file mode 100644 index 0000000..3ae680c --- /dev/null +++ b/patches.suse/cgroup1-don-t-allow-n-in-renaming.patch @@ -0,0 +1,58 @@ +From: Alexander Kuznetsov +Date: Wed, 9 Jun 2021 10:17:19 +0300 +Subject: cgroup1: don't allow '\n' in renaming +Git-commit: b7e24eb1caa5f8da20d405d262dba67943aedc42 +Patch-mainline: v5.13-rc6 +References: bsc#1187972 + +cgroup_mkdir() have restriction on newline usage in names: +$ mkdir $'/sys/fs/cgroup/cpu/test\ntest2' +mkdir: cannot create directory +'/sys/fs/cgroup/cpu/test\ntest2': Invalid argument + +But in cgroup1_rename() such check is missed. +This allows us to make /proc//cgroup unparsable: +$ mkdir /sys/fs/cgroup/cpu/test +$ mv /sys/fs/cgroup/cpu/test $'/sys/fs/cgroup/cpu/test\ntest2' +$ echo $$ > $'/sys/fs/cgroup/cpu/test\ntest2' +$ cat /proc/self/cgroup +11:pids:/ +10:freezer:/ +9:hugetlb:/ +8:cpuset:/ +7:blkio:/user.slice +6:memory:/user.slice +5:net_cls,net_prio:/ +4:perf_event:/ +3:devices:/user.slice +2:cpu,cpuacct:/test +test2 +1:name=systemd:/ +0::/ + +Signed-off-by: Alexander Kuznetsov +Reported-by: Andrey Krasichkov +Acked-by: Dmitry Yakunin +Cc: stable@vger.kernel.org +Signed-off-by: Tejun Heo +Acked-by: Michal Koutný +--- + kernel/cgroup/cgroup-v1.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index 8190b6bfc9784..1f274d7fc934e 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -820,6 +820,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent + struct cgroup *cgrp = kn->priv; + int ret; + ++ /* do not accept '\n' to prevent making /proc//cgroup unparsable */ ++ if (strchr(new_name_str, '\n')) ++ return -EINVAL; ++ + if (kernfs_type(kn) != KERNFS_DIR) + return -ENOTDIR; + if (kn->parent != new_parent) + diff --git a/patches.suse/qla2xxx-synchronize-rport-dev_loss_tmo-setting.patch b/patches.suse/qla2xxx-synchronize-rport-dev_loss_tmo-setting.patch new file mode 100644 index 0000000..e4d46c5 --- /dev/null +++ b/patches.suse/qla2xxx-synchronize-rport-dev_loss_tmo-setting.patch @@ -0,0 +1,97 @@ +From: Hannes Reinecke +Date: Wed, 9 Jun 2021 11:49:56 +0200 +Subject: qla2xxx: synchronize rport dev_loss_tmo setting +Patch-mainline: submitted - 2021-07-02 - https://patchwork.kernel.org/project/linux-scsi/patch/20210702092052.93202-1-dwagner@suse.de/ +References: bsc#1182470 bsc#1185486 + +Currently, the dev_loss_tmo setting is only ever used for SCSI +devices. This patch reshuffles initialisation such that the SCSI +remote ports are registered before the NVMe ones, allowing the +dev_loss_tmo setting to be synchronized between SCSI and NVMe. + +Signed-off-by: Hannes Reinecke +Signed-off-by: Daniel Wagner +[lkp: Do not depend on nvme_fc_set_remoteport_devloss() for !NVME_FC] +Reported-by: kernel test robot +--- + + https://lore.kernel.org/linux-scsi/20210702092052.93202-1-dwagner@suse.de/ + + drivers/scsi/qla2xxx/qla_attr.c | 6 ++++++ + drivers/scsi/qla2xxx/qla_init.c | 10 +++------- + drivers/scsi/qla2xxx/qla_nvme.c | 5 ++++- + 3 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c +index 3aa9869f6fae..dad48a982804 100644 +--- a/drivers/scsi/qla2xxx/qla_attr.c ++++ b/drivers/scsi/qla2xxx/qla_attr.c +@@ -2648,7 +2648,13 @@ qla2x00_get_starget_port_id(struct scsi_target *starget) + static inline void + qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) + { ++ fc_port_t *fcport = *(fc_port_t **)rport->dd_data; ++ + rport->dev_loss_tmo = timeout ? timeout : 1; ++ ++ if (IS_ENABLED(CONFIG_NVME_FC) && fcport->nvme_remote_port) ++ nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, ++ rport->dev_loss_tmo); + } + + static void +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c +index 0de250570e39..d078f16933c0 100644 +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -5631,13 +5631,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) + + qla2x00_dfs_create_rport(vha, fcport); + +- if (NVME_TARGET(vha->hw, fcport)) { +- qla_nvme_register_remote(vha, fcport); +- qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_COMPLETE); +- qla2x00_set_fcport_state(fcport, FCS_ONLINE); +- return; +- } +- + qla24xx_update_fcport_fcp_prio(vha, fcport); + + switch (vha->host->active_mode) { +@@ -5659,6 +5652,9 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) + break; + } + ++ if (NVME_TARGET(vha->hw, fcport)) ++ qla_nvme_register_remote(vha, fcport); ++ + qla2x00_set_fcport_state(fcport, FCS_ONLINE); + + if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { +diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c +index 0cacb667a88b..678083a34e4d 100644 +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c + +@@ -41,7 +41,7 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) + req.port_name = wwn_to_u64(fcport->port_name); + req.node_name = wwn_to_u64(fcport->node_name); + req.port_role = 0; +- req.dev_loss_tmo = 0; ++ req.dev_loss_tmo = fcport->dev_loss_tmo; + + if (fcport->nvme_prli_service_param & NVME_PRLI_SP_INITIATOR) + req.port_role = FC_PORT_ROLE_NVME_INITIATOR; +@@ -68,6 +68,9 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) + return ret; + } + ++ nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, ++ fcport->dev_loss_tmo); ++ + if (fcport->nvme_prli_service_param & NVME_PRLI_SP_SLER) + ql_log(ql_log_info, vha, 0x212a, + "PortID:%06x Supports SLER\n", req.port_id); +-- +2.29.2 + diff --git a/patches.suse/scsi-ufs-ufshcd-pltfrm-depends-on-HAS_IOMEM b/patches.suse/scsi-ufs-ufshcd-pltfrm-depends-on-HAS_IOMEM new file mode 100644 index 0000000..f83475e --- /dev/null +++ b/patches.suse/scsi-ufs-ufshcd-pltfrm-depends-on-HAS_IOMEM @@ -0,0 +1,45 @@ +From: Randy Dunlap +Date: Tue, 5 Jan 2021 20:08:22 -0800 +Subject: scsi: ufs: ufshcd-pltfrm depends on HAS_IOMEM +Git-commit: 5e6ddadf7637d336acaad1df1f3bcbb07f7d104d +Patch-mainline: v5.11-rc5 +References: bsc#1187980 + +Building ufshcd-pltfrm.c on arch/s390/ has a linker error since S390 does +not support IOMEM, so add a dependency on HAS_IOMEM. + +s390-linux-ld: drivers/scsi/ufs/ufshcd-pltfrm.o: in function `ufshcd_pltfrm_init': +ufshcd-pltfrm.c:(.text+0x38e): undefined reference to `devm_platform_ioremap_resource' + +where that devm_ function is inside an #ifdef CONFIG_HAS_IOMEM/#endif +block. + +[lduncan: refreshed to match current Kconfig help messages format] + +Link: lore.kernel.org/r/202101031125.ZEFCUiKi-lkp@intel.com +Link: https://lore.kernel.org/r/20210106040822.933-1-rdunlap@infradead.org +Fixes: 03b1781aa978 ("[SCSI] ufs: Add Platform glue driver for ufshcd") +Cc: "James E.J. Bottomley" +Cc: "Martin K. Petersen" +Cc: Alim Akhtar +Cc: Avri Altman +Cc: linux-scsi@vger.kernel.org +Reported-by: kernel test robot +Signed-off-by: Randy Dunlap +Signed-off-by: Martin K. Petersen +Acked-by: Lee Duncan +--- + drivers/scsi/ufs/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/ufs/Kconfig ++++ b/drivers/scsi/ufs/Kconfig +@@ -72,6 +72,7 @@ config SCSI_UFS_DWC_TC_PCI + config SCSI_UFSHCD_PLATFORM + tristate "Platform bus based UFS Controller support" + depends on SCSI_UFSHCD ++ depends on HAS_IOMEM + ---help--- + This selects the UFS host controller support. Select this if + you have an UFS controller on Platform bus. + diff --git a/patches.suse/x86-pkru-write-hardware-init-value-to-pkru-when-xstate-is-init.patch b/patches.suse/x86-pkru-write-hardware-init-value-to-pkru-when-xstate-is-init.patch new file mode 100644 index 0000000..2158eea --- /dev/null +++ b/patches.suse/x86-pkru-write-hardware-init-value-to-pkru-when-xstate-is-init.patch @@ -0,0 +1,93 @@ +From: Thomas Gleixner +Date: Tue, 8 Jun 2021 16:36:21 +0200 +Subject: x86/pkru: Write hardware init value to PKRU when xstate is init +Git-commit: 510b80a6a0f1a0d114c6e33bcea64747d127973c +Patch-mainline: v5.13-rc7 +References: bsc#1152489 + +When user space brings PKRU into init state, then the kernel handling is +broken: + + T1 user space + xsave(state) + state.header.xfeatures &= ~XFEATURE_MASK_PKRU; + xrstor(state) + + T1 -> kernel + schedule() + XSAVE(S) -> T1->xsave.header.xfeatures[PKRU] == 0 + T1->flags |= TIF_NEED_FPU_LOAD; + + wrpkru(); + + schedule() + ... + pk = get_xsave_addr(&T1->fpu->state.xsave, XFEATURE_PKRU); + if (pk) + wrpkru(pk->pkru); + else + wrpkru(DEFAULT_PKRU); + +Because the xfeatures bit is 0 and therefore the value in the xsave +storage is not valid, get_xsave_addr() returns NULL and switch_to() +writes the default PKRU. -> FAIL #1! + +So that wrecks any copy_to/from_user() on the way back to user space +which hits memory which is protected by the default PKRU value. + +Assumed that this does not fail (pure luck) then T1 goes back to user +space and because TIF_NEED_FPU_LOAD is set it ends up in + + switch_fpu_return() + __fpregs_load_activate() + if (!fpregs_state_valid()) { + load_XSTATE_from_task(); + } + +But if nothing touched the FPU between T1 scheduling out and back in, +then the fpregs_state is still valid which means switch_fpu_return() +does nothing and just clears TIF_NEED_FPU_LOAD. Back to user space with +DEFAULT_PKRU loaded. -> FAIL #2! + +The fix is simple: if get_xsave_addr() returns NULL then set the +PKRU value to 0 instead of the restrictive default PKRU value in +init_pkru_value. + + [ bp: Massage in minor nitpicks from folks. ] + +Fixes: 0cecca9d03c9 ("x86/fpu: Eager switch PKRU state") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Acked-by: Dave Hansen +Acked-by: Rik van Riel +Tested-by: Babu Moger +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20210608144346.045616965@linutronix.de +--- + arch/x86/include/asm/fpu/internal.h | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h +index 18382ac1ecc4..fdee23ea4e17 100644 +--- a/arch/x86/include/asm/fpu/internal.h ++++ b/arch/x86/include/asm/fpu/internal.h +@@ -579,9 +579,16 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) + * return to userland e.g. for a copy_to_user() operation. + */ + if (!(current->flags & PF_KTHREAD)) { ++ /* ++ * If the PKRU bit in xsave.header.xfeatures is not set, ++ * then the PKRU component was in init state, which means ++ * XRSTOR will set PKRU to 0. If the bit is not set then ++ * get_xsave_addr() will return NULL because the PKRU value ++ * in memory is not valid. This means pkru_val has to be ++ * set to 0 and not to init_pkru_value. ++ */ + pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); +- if (pk) +- pkru_val = pk->pkru; ++ pkru_val = pk ? pk->pkru : 0; + } + __write_pkru(pkru_val); + } + diff --git a/patches.suse/x86-process-check-pf_kthread-and-not-current-mm-for-kernel-threads.patch b/patches.suse/x86-process-check-pf_kthread-and-not-current-mm-for-kernel-threads.patch new file mode 100644 index 0000000..bf3d04c --- /dev/null +++ b/patches.suse/x86-process-check-pf_kthread-and-not-current-mm-for-kernel-threads.patch @@ -0,0 +1,38 @@ +From: Thomas Gleixner +Date: Tue, 8 Jun 2021 16:36:20 +0200 +Subject: x86/process: Check PF_KTHREAD and not current->mm for kernel threads +Git-commit: 12f7764ac61200e32c916f038bdc08f884b0b604 +Patch-mainline: v5.13-rc7 +References: bsc#1152489 + +switch_fpu_finish() checks current->mm as indicator for kernel threads. +That's wrong because kernel threads can temporarily use a mm of a user +process via kthread_use_mm(). + +Check the task flags for PF_KTHREAD instead. + +Fixes: 0cecca9d03c9 ("x86/fpu: Eager switch PKRU state") +Signed-off-by: Thomas Gleixner +Signed-off-by: Borislav Petkov +Acked-by: Dave Hansen +Acked-by: Rik van Riel +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20210608144345.912645927@linutronix.de +--- + arch/x86/include/asm/fpu/internal.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h +index ceeba9f63172..18382ac1ecc4 100644 +--- a/arch/x86/include/asm/fpu/internal.h ++++ b/arch/x86/include/asm/fpu/internal.h +@@ -578,7 +578,7 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) + * PKRU state is switched eagerly because it needs to be valid before we + * return to userland e.g. for a copy_to_user() operation. + */ +- if (current->mm) { ++ if (!(current->flags & PF_KTHREAD)) { + pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); + if (pk) + pkru_val = pk->pkru; + diff --git a/series.conf b/series.conf index 552323f..80d45de 100644 --- a/series.conf +++ b/series.conf @@ -18159,6 +18159,7 @@ patches.suse/mmc-core-don-t-initialize-block-size-from-ext_csd-if.patch patches.suse/dm-avoid-filesystem-lookup-in-dm_get_dev_t.patch patches.suse/scsi-megaraid_sas-Fix-MEGASAS_IOC_FIRMWARE-regression + patches.suse/scsi-ufs-ufshcd-pltfrm-depends-on-HAS_IOMEM patches.suse/scsi-scsi_transport_srp-Don-t-block-target-in-failfa.patch patches.suse/scsi-libfc-Avoid-invoking-response-handler-twice-if-.patch patches.suse/scsi-ibmvfc-Set-default-timeout-to-avoid-crash-durin.patch @@ -19874,6 +19875,7 @@ patches.suse/regulator-max77620-Use-device_set_of_node_from_dev.patch patches.suse/spi-stm32-qspi-Always-wait-BUSY-bit-to-be-cleared-in.patch patches.suse/vmlinux.lds.h-Avoid-orphan-section-with-SMP.patch + patches.suse/cgroup1-don-t-allow-n-in-renaming.patch patches.suse/hwmon-scpi-hwmon-shows-the-negative-temperature-prop.patch patches.suse/ASoC-rt5659-Fix-the-lost-powers-for-the-HDA-header.patch patches.suse/drm-Fix-use-after-free-read-in-drm_getunique.patch @@ -19939,10 +19941,13 @@ patches.suse/bnxt_en-Call-bnxt_ethtool_free-in-bnxt_init_one-erro.patch patches.suse/cfg80211-make-certificate-generation-more-robust.patch patches.suse/cfg80211-avoid-double-free-of-PMSR-request.patch + patches.suse/x86-process-check-pf_kthread-and-not-current-mm-for-kernel-threads.patch + patches.suse/x86-pkru-write-hardware-init-value-to-pkru-when-xstate-is-init.patch patches.suse/module-limit-enabling-module.sig_enforce.patch patches.suse/Revert-PCI-PM-Do-not-read-power-state-in-pci_enable_.patch patches.suse/spi-spi-nxp-fspi-move-the-register-operation-after-t.patch patches.suse/mmc-meson-gx-use-memcpy_to-fromio-for-dram-access-qu.patch + patches.suse/ceph-must-hold-snap_rwsem-when-filling-inode-for-async-create.patch patches.suse/kthread_worker-split-code-for-canceling-the-delayed-.patch patches.suse/kthread-prevent-deadlock-when-kthread_mod_delayed_wo.patch patches.suse/s390-stack-fix-possible-register-corruption-with-stack-switch-helper.patch @@ -20001,6 +20006,7 @@ patches.suse/nxp-nci-add-NXP1002-id.patch patches.suse/locking-rwsem-Disable-reader-optimistic-spinning.patch patches.suse/sched-fair-Enable-SIS_AVG_CPU-by-default.patch + patches.suse/qla2xxx-synchronize-rport-dev_loss_tmo-setting.patch ######################################################## # kbuild/module infrastructure fixes