From: Greg Kroah-Hartman Date: Mon, 15 Nov 2021 12:43:02 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.4.160~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e63cca5c9a5acc45d4e0665a57988e6baeea531;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: arm-9155-1-fix-early-early_iounmap.patch arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch mips-fix-duplicated-slashes-for-platform-file-path.patch mips-fix-pkg-builds-for-loongson2ef-platform.patch parisc-fix-backtrace-to-always-include-init-funtion-names.patch parisc-flush-kernel-data-mapping-in-set_pte_at-when-installing-pte-for-user-page.patch pci-msi-destroy-sysfs-before-freeing-entries.patch pci-msi-move-non-mask-check-back-into-low-level-accessors.patch smb3-do-not-error-on-fsync-when-readonly.patch x86-mce-add-errata-workaround-for-skylake-skx37.patch --- diff --git a/queue-5.15/arm-9155-1-fix-early-early_iounmap.patch b/queue-5.15/arm-9155-1-fix-early-early_iounmap.patch new file mode 100644 index 00000000000..0e8b393c4d8 --- /dev/null +++ b/queue-5.15/arm-9155-1-fix-early-early_iounmap.patch @@ -0,0 +1,40 @@ +From 0d08e7bf0d0d1a29aff7b16ef516f7415eb1aa05 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= +Date: Thu, 4 Nov 2021 17:28:28 +0100 +Subject: ARM: 9155/1: fix early early_iounmap() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michał Mirosław + +commit 0d08e7bf0d0d1a29aff7b16ef516f7415eb1aa05 upstream. + +Currently __set_fixmap() bails out with a warning when called in early boot +from early_iounmap(). Fix it, and while at it, make the comment a bit easier +to understand. + +Cc: +Fixes: b089c31c519c ("ARM: 8667/3: Fix memory attribute inconsistencies when using fixmap") +Acked-by: Ard Biesheuvel +Signed-off-by: Michał Mirosław +Signed-off-by: Russell King (Oracle) +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/mm/mmu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/mm/mmu.c ++++ b/arch/arm/mm/mmu.c +@@ -390,9 +390,9 @@ void __set_fixmap(enum fixed_addresses i + BUILD_BUG_ON(__fix_to_virt(__end_of_fixed_addresses) < FIXADDR_START); + BUG_ON(idx >= __end_of_fixed_addresses); + +- /* we only support device mappings until pgprot_kernel has been set */ ++ /* We support only device mappings before pgprot_kernel is set. */ + if (WARN_ON(pgprot_val(prot) != pgprot_val(FIXMAP_PAGE_IO) && +- pgprot_val(pgprot_kernel) == 0)) ++ pgprot_val(prot) && pgprot_val(pgprot_kernel) == 0)) + return; + + if (pgprot_val(prot)) diff --git a/queue-5.15/arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch b/queue-5.15/arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch new file mode 100644 index 00000000000..576bbd1c165 --- /dev/null +++ b/queue-5.15/arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch @@ -0,0 +1,103 @@ +From 418ace9992a7647c446ed3186df40cf165b67298 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Sat, 6 Nov 2021 19:42:29 +0100 +Subject: ARM: 9156/1: drop cc-option fallbacks for architecture selection + +From: Arnd Bergmann + +commit 418ace9992a7647c446ed3186df40cf165b67298 upstream. + +Naresh and Antonio ran into a build failure with latest Debian +armhf compilers, with lots of output like + + tmp/ccY3nOAs.s:2215: Error: selected processor does not support `cpsid i' in ARM mode + +As it turns out, $(cc-option) fails early here when the FPU is not +selected before CPU architecture is selected, as the compiler +option check runs before enabling -msoft-float, which causes +a problem when testing a target architecture level without an FPU: + +cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU + +Passing e.g. -march=armv6k+fp in place of -march=armv6k would avoid this +issue, but the fallback logic is already broken because all supported +compilers (gcc-5 and higher) are much more recent than these options, +and building with -march=armv5t as a fallback no longer works. + +The best way forward that I see is to just remove all the checks, which +also has the nice side-effect of slightly improving the startup time for +'make'. + +The -mtune=marvell-f option was apparently never supported by any mainline +compiler, and the custom Codesourcery gcc build that did support is +now too old to build kernels, so just use -mtune=xscale unconditionally +for those. + +This should be safe to apply on all stable kernels, and will be required +in order to keep building them with gcc-11 and higher. + +Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996419 + +Reported-by: Antonio Terceiro +Reported-by: Naresh Kamboju +Reported-by: Sebastian Andrzej Siewior +Tested-by: Sebastian Reichel +Tested-by: Klaus Kudielka +Cc: Matthias Klose +Cc: stable@vger.kernel.org +Signed-off-by: Arnd Bergmann +Signed-off-by: Russell King (Oracle) +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/Makefile | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -60,15 +60,15 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i + # Note that GCC does not numerically define an architecture version + # macro, but instead defines a whole series of macros which makes + # testing for a specific architecture or later rather impossible. +-arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m +-arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) +-arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) ++arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m ++arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -march=armv7-a ++arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 -march=armv6 + # Only override the compiler option if ARMv6. The ARMv6K extensions are + # always available in ARMv7 + ifeq ($(CONFIG_CPU_32v6),y) +-arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k) ++arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 -march=armv6k + endif +-arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) ++arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 -march=armv5te + arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t + arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4 + arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3m +@@ -82,7 +82,7 @@ tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7t + tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi + tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi + tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi +-tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi) ++tune-$(CONFIG_CPU_ARM946E) =-mtune=arm9e + tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi + tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi + tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi +@@ -90,11 +90,11 @@ tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9t + tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi + tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110 + tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100 +-tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale +-tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale +-tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale) +-tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) +-tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) ++tune-$(CONFIG_CPU_XSCALE) =-mtune=xscale ++tune-$(CONFIG_CPU_XSC3) =-mtune=xscale ++tune-$(CONFIG_CPU_FEROCEON) =-mtune=xscale ++tune-$(CONFIG_CPU_V6) =-mtune=arm1136j-s ++tune-$(CONFIG_CPU_V6K) =-mtune=arm1136j-s + + # Evaluate tune cc-option calls now + tune-y := $(tune-y) diff --git a/queue-5.15/mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch b/queue-5.15/mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch new file mode 100644 index 00000000000..5d948430986 --- /dev/null +++ b/queue-5.15/mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch @@ -0,0 +1,80 @@ +From a923a2676e60683aee46aa4b93c30aff240ac20d Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" +Date: Fri, 22 Oct 2021 00:58:23 +0200 +Subject: MIPS: Fix assembly error from MIPSr2 code used within MIPS_ISA_ARCH_LEVEL + +From: Maciej W. Rozycki + +commit a923a2676e60683aee46aa4b93c30aff240ac20d upstream. + +Fix assembly errors like: + +{standard input}: Assembler messages: +{standard input}:287: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' +{standard input}:680: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' +{standard input}:1274: Error: opcode not supported on this processor: mips3 (mips3) `dins $12,$9,32,32' +{standard input}:2175: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' +make[1]: *** [scripts/Makefile.build:277: mm/highmem.o] Error 1 + +with code produced from `__cmpxchg64' for MIPS64r2 CPU configurations +using CONFIG_32BIT and CONFIG_PHYS_ADDR_T_64BIT. + +This is due to MIPS_ISA_ARCH_LEVEL downgrading the assembly architecture +to `r4000' i.e. MIPS III for MIPS64r2 configurations, while there is a +block of code containing a DINS MIPS64r2 instruction conditionalized on +MIPS_ISA_REV >= 2 within the scope of the downgrade. + +The assembly architecture override code pattern has been put there for +LL/SC instructions, so that code compiles for configurations that select +a processor to build for that does not support these instructions while +still providing run-time support for processors that do, dynamically +switched by non-constant `cpu_has_llsc'. It went in with linux-mips.org +commit aac8aa7717a2 ("Enable a suitable ISA for the assembler around +ll/sc so that code builds even for processors that don't support the +instructions. Plus minor formatting fixes.") back in 2005. + +Fix the problem by wrapping these instructions along with the adjacent +SYNC instructions only, following the practice established with commit +cfd54de3b0e4 ("MIPS: Avoid move psuedo-instruction whilst using +MIPS_ISA_LEVEL") and commit 378ed6f0e3c5 ("MIPS: Avoid using .set mips0 +to restore ISA"). Strictly speaking the SYNC instructions do not have +to be wrapped as they are only used as a Loongson3 erratum workaround, +so they will be enabled in the assembler by default, but do this so as +to keep code consistent with other places. + +Reported-by: kernel test robot +Signed-off-by: Maciej W. Rozycki +Fixes: c7e2d71dda7a ("MIPS: Fix set_pte() for Netlogic XLR using cmpxchg64()") +Cc: stable@vger.kernel.org # v5.1+ +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/include/asm/cmpxchg.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/arch/mips/include/asm/cmpxchg.h ++++ b/arch/mips/include/asm/cmpxchg.h +@@ -249,6 +249,7 @@ static inline unsigned long __cmpxchg64( + /* Load 64 bits from ptr */ + " " __SYNC(full, loongson3_war) " \n" + "1: lld %L0, %3 # __cmpxchg64 \n" ++ " .set pop \n" + /* + * Split the 64 bit value we loaded into the 2 registers that hold the + * ret variable. +@@ -276,12 +277,14 @@ static inline unsigned long __cmpxchg64( + " or %L1, %L1, $at \n" + " .set at \n" + # endif ++ " .set push \n" ++ " .set " MIPS_ISA_ARCH_LEVEL " \n" + /* Attempt to store new at ptr */ + " scd %L1, %2 \n" + /* If we failed, loop! */ + "\t" __SC_BEQZ "%L1, 1b \n" +- " .set pop \n" + "2: " __SYNC(full, loongson3_war) " \n" ++ " .set pop \n" + : "=&r"(ret), + "=&r"(tmp), + "=" GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr) diff --git a/queue-5.15/mips-fix-duplicated-slashes-for-platform-file-path.patch b/queue-5.15/mips-fix-duplicated-slashes-for-platform-file-path.patch new file mode 100644 index 00000000000..e92ab9ed40a --- /dev/null +++ b/queue-5.15/mips-fix-duplicated-slashes-for-platform-file-path.patch @@ -0,0 +1,33 @@ +From cca2aac8acf470b01066f559acd7146fc4c32ae8 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Wed, 10 Nov 2021 00:01:46 +0900 +Subject: MIPS: fix duplicated slashes for Platform file path + +From: Masahiro Yamada + +commit cca2aac8acf470b01066f559acd7146fc4c32ae8 upstream. + +platform-y accumulates platform names with a slash appended. +The current $(patsubst ...) ends up with doubling slashes. + +GNU Make still include Platform files, but in case of an error, +a clumsy file path is displayed: + + arch/mips/loongson2ef//Platform:36: *** only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop. Stop. + +Signed-off-by: Masahiro Yamada +Signed-off-by: Thomas Bogendoerfer +Cc: Jason Self +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/Kbuild.platforms | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/Kbuild.platforms ++++ b/arch/mips/Kbuild.platforms +@@ -38,4 +38,4 @@ platform-$(CONFIG_MACH_TX49XX) += txx9/ + platform-$(CONFIG_MACH_VR41XX) += vr41xx/ + + # include the platform specific files +-include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platform-y)) ++include $(patsubst %/, $(srctree)/arch/mips/%/Platform, $(platform-y)) diff --git a/queue-5.15/mips-fix-pkg-builds-for-loongson2ef-platform.patch b/queue-5.15/mips-fix-pkg-builds-for-loongson2ef-platform.patch new file mode 100644 index 00000000000..3abe4f25bbd --- /dev/null +++ b/queue-5.15/mips-fix-pkg-builds-for-loongson2ef-platform.patch @@ -0,0 +1,55 @@ +From 0706f74f719e6e72c3a862ab2990796578fa73cc Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Wed, 10 Nov 2021 00:01:45 +0900 +Subject: MIPS: fix *-pkg builds for loongson2ef platform + +From: Masahiro Yamada + +commit 0706f74f719e6e72c3a862ab2990796578fa73cc upstream. + +Since commit 805b2e1d427a ("kbuild: include Makefile.compiler only when +compiler is needed"), package builds for the loongson2f platform fail. + + $ make ARCH=mips CROSS_COMPILE=mips64-linux- lemote2f_defconfig bindeb-pkg + [ snip ] + sh ./scripts/package/builddeb + arch/mips/loongson2ef//Platform:36: *** only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop. Stop. + cp: cannot stat '': No such file or directory + make[5]: *** [scripts/Makefile.package:87: intdeb-pkg] Error 1 + make[4]: *** [Makefile:1558: intdeb-pkg] Error 2 + make[3]: *** [debian/rules:13: binary-arch] Error 2 + dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2 + make[2]: *** [scripts/Makefile.package:83: bindeb-pkg] Error 2 + make[1]: *** [Makefile:1558: bindeb-pkg] Error 2 + make: *** [Makefile:350: __build_one_by_one] Error 2 + +The reason is because "make image_name" fails. + + $ make ARCH=mips CROSS_COMPILE=mips64-linux- image_name + arch/mips/loongson2ef//Platform:36: *** only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop. Stop. + +In general, adding $(error ...) in the parse stage is troublesome, +and it is pointless to check toolchains even if we are not building +anything. Do not include Kbuild.platform in such cases. + +Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed") +Reported-by: Jason Self +Signed-off-by: Masahiro Yamada +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -254,7 +254,9 @@ endif + # + # Board-dependent options and extra files + # ++ifdef need-compiler + include $(srctree)/arch/mips/Kbuild.platforms ++endif + + ifdef CONFIG_PHYSICAL_START + load-y = $(CONFIG_PHYSICAL_START) diff --git a/queue-5.15/parisc-fix-backtrace-to-always-include-init-funtion-names.patch b/queue-5.15/parisc-fix-backtrace-to-always-include-init-funtion-names.patch new file mode 100644 index 00000000000..031df618379 --- /dev/null +++ b/queue-5.15/parisc-fix-backtrace-to-always-include-init-funtion-names.patch @@ -0,0 +1,57 @@ +From 279917e27edc293eb645a25428c6ab3f3bca3f86 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Thu, 4 Nov 2021 20:19:00 +0100 +Subject: parisc: Fix backtrace to always include init funtion names + +From: Helge Deller + +commit 279917e27edc293eb645a25428c6ab3f3bca3f86 upstream. + +I noticed that sometimes at kernel startup the backtraces did not +included the function names of init functions. Their address were not +resolved to function names and instead only the address was printed. + +Debugging shows that the culprit is is_ksym_addr() which is called +by the backtrace functions to check if an address belongs to a function in +the kernel. The problem occurs only for CONFIG_KALLSYMS_ALL=y. + +When looking at is_ksym_addr() one can see that for CONFIG_KALLSYMS_ALL=y +the function only tries to resolve the address via is_kernel() function, +which checks like this: + if (addr >= _stext && addr <= _end) + return 1; +On parisc the init functions are located before _stext, so this check fails. +Other platforms seem to have all functions (including init functions) +behind _stext. + +The following patch moves the _stext symbol at the beginning of the +kernel and thus includes the init section. This fixes the check and does +not seem to have any negative side effects on where the kernel mapping +happens in the map_pages() function in arch/parisc/mm/init.c. + +Signed-off-by: Helge Deller +Cc: stable@kernel.org # 5.4+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/vmlinux.lds.S | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/parisc/kernel/vmlinux.lds.S ++++ b/arch/parisc/kernel/vmlinux.lds.S +@@ -57,6 +57,8 @@ SECTIONS + { + . = KERNEL_BINARY_TEXT_START; + ++ _stext = .; /* start of kernel text, includes init code & data */ ++ + __init_begin = .; + HEAD_TEXT_SECTION + MLONGCALL_DISCARD(INIT_TEXT_SECTION(8)) +@@ -80,7 +82,6 @@ SECTIONS + /* freed after init ends here */ + + _text = .; /* Text and read-only data */ +- _stext = .; + MLONGCALL_KEEP(INIT_TEXT_SECTION(8)) + .text ALIGN(PAGE_SIZE) : { + TEXT_TEXT diff --git a/queue-5.15/parisc-flush-kernel-data-mapping-in-set_pte_at-when-installing-pte-for-user-page.patch b/queue-5.15/parisc-flush-kernel-data-mapping-in-set_pte_at-when-installing-pte-for-user-page.patch new file mode 100644 index 00000000000..7789591bdbc --- /dev/null +++ b/queue-5.15/parisc-flush-kernel-data-mapping-in-set_pte_at-when-installing-pte-for-user-page.patch @@ -0,0 +1,93 @@ +From 38860b2c8bb1b92f61396eb06a63adff916fc31d Mon Sep 17 00:00:00 2001 +From: John David Anglin +Date: Mon, 8 Nov 2021 16:48:16 -0500 +Subject: parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page + +From: John David Anglin + +commit 38860b2c8bb1b92f61396eb06a63adff916fc31d upstream. + +For years, there have been random segmentation faults in userspace on +SMP PA-RISC machines. It occurred to me that this might be a problem in +set_pte_at(). MIPS and some other architectures do cache flushes when +installing PTEs with the present bit set. + +Here I have adapted the code in update_mmu_cache() to flush the kernel +mapping when the kernel flush is deferred, or when the kernel mapping +may alias with the user mapping. This simplifies calls to +update_mmu_cache(). + +I also changed the barrier in set_pte() from a compiler barrier to a +full memory barrier. I know this change is not sufficient to fix the +problem. It might not be needed. + +I have had a few days of operation with 5.14.16 to 5.15.1 and haven't +seen any random segmentation faults on rp3440 or c8000 so far. + +Signed-off-by: John David Anglin +Signed-off-by: Helge Deller +Cc: stable@kernel.org # 5.12+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/include/asm/pgtable.h | 10 ++++++++-- + arch/parisc/kernel/cache.c | 4 ++-- + 2 files changed, 10 insertions(+), 4 deletions(-) + +--- a/arch/parisc/include/asm/pgtable.h ++++ b/arch/parisc/include/asm/pgtable.h +@@ -76,6 +76,8 @@ static inline void purge_tlb_entries(str + purge_tlb_end(flags); + } + ++extern void __update_cache(pte_t pte); ++ + /* Certain architectures need to do special things when PTEs + * within a page table are directly modified. Thus, the following + * hook is made available. +@@ -83,11 +85,14 @@ static inline void purge_tlb_entries(str + #define set_pte(pteptr, pteval) \ + do { \ + *(pteptr) = (pteval); \ +- barrier(); \ ++ mb(); \ + } while(0) + + #define set_pte_at(mm, addr, pteptr, pteval) \ + do { \ ++ if (pte_present(pteval) && \ ++ pte_user(pteval)) \ ++ __update_cache(pteval); \ + *(pteptr) = (pteval); \ + purge_tlb_entries(mm, addr); \ + } while (0) +@@ -303,6 +308,7 @@ extern unsigned long *empty_zero_page; + + #define pte_none(x) (pte_val(x) == 0) + #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) ++#define pte_user(x) (pte_val(x) & _PAGE_USER) + #define pte_clear(mm, addr, xp) set_pte_at(mm, addr, xp, __pte(0)) + + #define pmd_flag(x) (pmd_val(x) & PxD_FLAG_MASK) +@@ -410,7 +416,7 @@ extern void paging_init (void); + + #define PG_dcache_dirty PG_arch_1 + +-extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); ++#define update_mmu_cache(vms,addr,ptep) __update_cache(*ptep) + + /* Encode and de-code a swap entry */ + +--- a/arch/parisc/kernel/cache.c ++++ b/arch/parisc/kernel/cache.c +@@ -83,9 +83,9 @@ EXPORT_SYMBOL(flush_cache_all_local); + #define pfn_va(pfn) __va(PFN_PHYS(pfn)) + + void +-update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) ++__update_cache(pte_t pte) + { +- unsigned long pfn = pte_pfn(*ptep); ++ unsigned long pfn = pte_pfn(pte); + struct page *page; + + /* We don't have pte special. As a result, we can be called with diff --git a/queue-5.15/pci-msi-destroy-sysfs-before-freeing-entries.patch b/queue-5.15/pci-msi-destroy-sysfs-before-freeing-entries.patch new file mode 100644 index 00000000000..f966533adfc --- /dev/null +++ b/queue-5.15/pci-msi-destroy-sysfs-before-freeing-entries.patch @@ -0,0 +1,52 @@ +From 3735459037114d31e5acd9894fad9aed104231a0 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Tue, 9 Nov 2021 14:53:57 +0100 +Subject: PCI/MSI: Destroy sysfs before freeing entries + +From: Thomas Gleixner + +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 +Reviewed-by: Greg Kroah-Hartman +Cc: Bjorn Helgaas +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/87sfw5305m.ffs@tglx +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/msi.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/pci/msi.c ++++ b/drivers/pci/msi.c +@@ -368,6 +368,11 @@ static void free_msi_irqs(struct pci_dev + for (i = 0; i < entry->nvec_used; i++) + BUG_ON(irq_has_action(entry->irq + i)); + ++ if (dev->msi_irq_groups) { ++ msi_destroy_sysfs(&dev->dev, 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) { +@@ -379,11 +384,6 @@ static void free_msi_irqs(struct pci_dev + list_del(&entry->list); + free_msi_entry(entry); + } +- +- if (dev->msi_irq_groups) { +- msi_destroy_sysfs(&dev->dev, dev->msi_irq_groups); +- dev->msi_irq_groups = NULL; +- } + } + + static void pci_intx_for_msi(struct pci_dev *dev, int enable) diff --git a/queue-5.15/pci-msi-move-non-mask-check-back-into-low-level-accessors.patch b/queue-5.15/pci-msi-move-non-mask-check-back-into-low-level-accessors.patch new file mode 100644 index 00000000000..a30fcb3a28a --- /dev/null +++ b/queue-5.15/pci-msi-move-non-mask-check-back-into-low-level-accessors.patch @@ -0,0 +1,143 @@ +From 9c8e9c9681a0f3f1ae90a90230d059c7a1dece5a Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Thu, 4 Nov 2021 00:27:29 +0100 +Subject: PCI/MSI: Move non-mask check back into low level accessors + +From: Thomas Gleixner + +commit 9c8e9c9681a0f3f1ae90a90230d059c7a1dece5a upstream. + +The recent rework of PCI/MSI[X] masking moved the non-mask checks from the +low level accessors into the higher level mask/unmask functions. + +This missed the fact that these accessors can be invoked from other places +as well. The missing checks break XEN-PV which sets pci_msi_ignore_mask and +also violates the virtual MSIX and the msi_attrib.maskbit protections. + +Instead of sprinkling checks all over the place, lift them back into the +low level accessor functions. To avoid checking three different conditions +combine them into one property of msi_desc::msi_attrib. + +[ josef: Fixed the missed conversion in the core code ] + +Fixes: fcacdfbef5a1 ("PCI/MSI: Provide a new set of mask and unmask functions") +Reported-by: Josef Johansson +Signed-off-by: Thomas Gleixner +Tested-by: Josef Johansson +Cc: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/msi.c | 26 ++++++++++++++------------ + include/linux/msi.h | 2 +- + kernel/irq/msi.c | 4 ++-- + 3 files changed, 17 insertions(+), 15 deletions(-) + +--- a/drivers/pci/msi.c ++++ b/drivers/pci/msi.c +@@ -148,6 +148,9 @@ static noinline void pci_msi_update_mask + raw_spinlock_t *lock = &desc->dev->msi_lock; + unsigned long flags; + ++ if (!desc->msi_attrib.can_mask) ++ return; ++ + raw_spin_lock_irqsave(lock, flags); + desc->msi_mask &= ~clear; + desc->msi_mask |= set; +@@ -181,7 +184,8 @@ static void pci_msix_write_vector_ctrl(s + { + void __iomem *desc_addr = pci_msix_desc_addr(desc); + +- writel(ctrl, desc_addr + PCI_MSIX_ENTRY_VECTOR_CTRL); ++ if (desc->msi_attrib.can_mask) ++ writel(ctrl, desc_addr + PCI_MSIX_ENTRY_VECTOR_CTRL); + } + + static inline void pci_msix_mask(struct msi_desc *desc) +@@ -200,23 +204,17 @@ static inline void pci_msix_unmask(struc + + static void __pci_msi_mask_desc(struct msi_desc *desc, u32 mask) + { +- if (pci_msi_ignore_mask || desc->msi_attrib.is_virtual) +- return; +- + if (desc->msi_attrib.is_msix) + pci_msix_mask(desc); +- else if (desc->msi_attrib.maskbit) ++ else + pci_msi_mask(desc, mask); + } + + static void __pci_msi_unmask_desc(struct msi_desc *desc, u32 mask) + { +- if (pci_msi_ignore_mask || desc->msi_attrib.is_virtual) +- return; +- + if (desc->msi_attrib.is_msix) + pci_msix_unmask(desc); +- else if (desc->msi_attrib.maskbit) ++ else + pci_msi_unmask(desc, mask); + } + +@@ -484,7 +482,8 @@ msi_setup_entry(struct pci_dev *dev, int + entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT); + entry->msi_attrib.is_virtual = 0; + entry->msi_attrib.entry_nr = 0; +- entry->msi_attrib.maskbit = !!(control & PCI_MSI_FLAGS_MASKBIT); ++ entry->msi_attrib.can_mask = !pci_msi_ignore_mask && ++ !!(control & PCI_MSI_FLAGS_MASKBIT); + entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ + entry->msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1; + entry->msi_attrib.multiple = ilog2(__roundup_pow_of_two(nvec)); +@@ -495,7 +494,7 @@ msi_setup_entry(struct pci_dev *dev, int + entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_32; + + /* Save the initial mask status */ +- if (entry->msi_attrib.maskbit) ++ if (entry->msi_attrib.can_mask) + pci_read_config_dword(dev, entry->mask_pos, &entry->msi_mask); + + out: +@@ -638,10 +637,13 @@ static int msix_setup_entries(struct pci + entry->msi_attrib.is_virtual = + entry->msi_attrib.entry_nr >= vec_count; + ++ entry->msi_attrib.can_mask = !pci_msi_ignore_mask && ++ !entry->msi_attrib.is_virtual; ++ + entry->msi_attrib.default_irq = dev->irq; + entry->mask_base = base; + +- if (!entry->msi_attrib.is_virtual) { ++ if (entry->msi_attrib.can_mask) { + addr = pci_msix_desc_addr(entry); + entry->msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL); + } +--- a/include/linux/msi.h ++++ b/include/linux/msi.h +@@ -148,7 +148,7 @@ struct msi_desc { + u8 is_msix : 1; + u8 multiple : 3; + u8 multi_cap : 3; +- u8 maskbit : 1; ++ u8 can_mask : 1; + u8 is_64 : 1; + u8 is_virtual : 1; + u16 entry_nr; +--- a/kernel/irq/msi.c ++++ b/kernel/irq/msi.c +@@ -529,10 +529,10 @@ static bool msi_check_reservation_mode(s + + /* + * Checking the first MSI descriptor is sufficient. MSIX supports +- * masking and MSI does so when the maskbit is set. ++ * masking and MSI does so when the can_mask attribute is set. + */ + desc = first_msi_entry(dev); +- return desc->msi_attrib.is_msix || desc->msi_attrib.maskbit; ++ return desc->msi_attrib.is_msix || desc->msi_attrib.can_mask; + } + + int __msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, diff --git a/queue-5.15/series b/queue-5.15/series index 89bf7f0c1b6..cc745aeb373 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -845,3 +845,14 @@ net-smc-fix-sk_refcnt-underflow-on-linkdown-and-fall.patch cxgb4-fix-eeprom-len-when-diagnostics-not-implemente.patch selftests-net-udpgso_bench_rx-fix-port-argument.patch thermal-int340x-fix-build-on-32-bit-targets.patch +smb3-do-not-error-on-fsync-when-readonly.patch +arm-9155-1-fix-early-early_iounmap.patch +arm-9156-1-drop-cc-option-fallbacks-for-architecture-selection.patch +parisc-fix-backtrace-to-always-include-init-funtion-names.patch +parisc-flush-kernel-data-mapping-in-set_pte_at-when-installing-pte-for-user-page.patch +mips-fix-duplicated-slashes-for-platform-file-path.patch +mips-fix-pkg-builds-for-loongson2ef-platform.patch +mips-fix-assembly-error-from-mipsr2-code-used-within-mips_isa_arch_level.patch +x86-mce-add-errata-workaround-for-skylake-skx37.patch +pci-msi-move-non-mask-check-back-into-low-level-accessors.patch +pci-msi-destroy-sysfs-before-freeing-entries.patch diff --git a/queue-5.15/smb3-do-not-error-on-fsync-when-readonly.patch b/queue-5.15/smb3-do-not-error-on-fsync-when-readonly.patch new file mode 100644 index 00000000000..42ac4772e7d --- /dev/null +++ b/queue-5.15/smb3-do-not-error-on-fsync-when-readonly.patch @@ -0,0 +1,89 @@ +From 71e6864eacbef0b2645ca043cdfbac272cb6cea3 Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Wed, 10 Nov 2021 01:47:48 -0600 +Subject: smb3: do not error on fsync when readonly + +From: Steve French + +commit 71e6864eacbef0b2645ca043cdfbac272cb6cea3 upstream. + +Linux allows doing a flush/fsync on a file open for read-only, +but the protocol does not allow that. If the file passed in +on the flush is read-only try to find a writeable handle for +the same inode, if that is not possible skip sending the +fsync call to the server to avoid breaking the apps. + +Reported-by: Julian Sikorski +Tested-by: Julian Sikorski +Suggested-by: Jeremy Allison +Reviewed-by: Paulo Alcantara (SUSE) +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/file.c | 35 +++++++++++++++++++++++++++++------ + 1 file changed, 29 insertions(+), 6 deletions(-) + +--- a/fs/cifs/file.c ++++ b/fs/cifs/file.c +@@ -2692,12 +2692,23 @@ int cifs_strict_fsync(struct file *file, + tcon = tlink_tcon(smbfile->tlink); + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) { + server = tcon->ses->server; +- if (server->ops->flush) +- rc = server->ops->flush(xid, tcon, &smbfile->fid); +- else ++ if (server->ops->flush == NULL) { + rc = -ENOSYS; ++ goto strict_fsync_exit; ++ } ++ ++ if ((OPEN_FMODE(smbfile->f_flags) & FMODE_WRITE) == 0) { ++ smbfile = find_writable_file(CIFS_I(inode), FIND_WR_ANY); ++ if (smbfile) { ++ rc = server->ops->flush(xid, tcon, &smbfile->fid); ++ cifsFileInfo_put(smbfile); ++ } else ++ cifs_dbg(FYI, "ignore fsync for file not open for write\n"); ++ } else ++ rc = server->ops->flush(xid, tcon, &smbfile->fid); + } + ++strict_fsync_exit: + free_xid(xid); + return rc; + } +@@ -2709,6 +2720,7 @@ int cifs_fsync(struct file *file, loff_t + struct cifs_tcon *tcon; + struct TCP_Server_Info *server; + struct cifsFileInfo *smbfile = file->private_data; ++ struct inode *inode = file_inode(file); + struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file); + + rc = file_write_and_wait_range(file, start, end); +@@ -2725,12 +2737,23 @@ int cifs_fsync(struct file *file, loff_t + tcon = tlink_tcon(smbfile->tlink); + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) { + server = tcon->ses->server; +- if (server->ops->flush) +- rc = server->ops->flush(xid, tcon, &smbfile->fid); +- else ++ if (server->ops->flush == NULL) { + rc = -ENOSYS; ++ goto fsync_exit; ++ } ++ ++ if ((OPEN_FMODE(smbfile->f_flags) & FMODE_WRITE) == 0) { ++ smbfile = find_writable_file(CIFS_I(inode), FIND_WR_ANY); ++ if (smbfile) { ++ rc = server->ops->flush(xid, tcon, &smbfile->fid); ++ cifsFileInfo_put(smbfile); ++ } else ++ cifs_dbg(FYI, "ignore fsync for file not open for write\n"); ++ } else ++ rc = server->ops->flush(xid, tcon, &smbfile->fid); + } + ++fsync_exit: + free_xid(xid); + return rc; + } diff --git a/queue-5.15/x86-mce-add-errata-workaround-for-skylake-skx37.patch b/queue-5.15/x86-mce-add-errata-workaround-for-skylake-skx37.patch new file mode 100644 index 00000000000..7f66c92618c --- /dev/null +++ b/queue-5.15/x86-mce-add-errata-workaround-for-skylake-skx37.patch @@ -0,0 +1,43 @@ +From e629fc1407a63dbb748f828f9814463ffc2a0af0 Mon Sep 17 00:00:00 2001 +From: Dave Jones +Date: Fri, 29 Oct 2021 16:57:59 -0400 +Subject: x86/mce: Add errata workaround for Skylake SKX37 + +From: Dave Jones + +commit e629fc1407a63dbb748f828f9814463ffc2a0af0 upstream. + +Errata SKX37 is word-for-word identical to the other errata listed in +this workaround. I happened to notice this after investigating a CMCI +storm on a Skylake host. While I can't confirm this was the root cause, +spurious corrected errors does sound like a likely suspect. + +Fixes: 2976908e4198 ("x86/mce: Do not log spurious corrected mce errors") +Signed-off-by: Dave Jones +Signed-off-by: Dave Hansen +Reviewed-by: Tony Luck +Cc: +Link: https://lkml.kernel.org/r/20211029205759.GA7385@codemonkey.org.uk +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/cpu/mce/intel.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/arch/x86/kernel/cpu/mce/intel.c ++++ b/arch/x86/kernel/cpu/mce/intel.c +@@ -547,12 +547,13 @@ bool intel_filter_mce(struct mce *m) + { + struct cpuinfo_x86 *c = &boot_cpu_data; + +- /* MCE errata HSD131, HSM142, HSW131, BDM48, and HSM142 */ ++ /* MCE errata HSD131, HSM142, HSW131, BDM48, HSM142 and SKX37 */ + if ((c->x86 == 6) && + ((c->x86_model == INTEL_FAM6_HASWELL) || + (c->x86_model == INTEL_FAM6_HASWELL_L) || + (c->x86_model == INTEL_FAM6_BROADWELL) || +- (c->x86_model == INTEL_FAM6_HASWELL_G)) && ++ (c->x86_model == INTEL_FAM6_HASWELL_G) || ++ (c->x86_model == INTEL_FAM6_SKYLAKE_X)) && + (m->bank == 0) && + ((m->status & 0xa0000000ffffffff) == 0x80000000000f0005)) + return true;