From: Greg Kroah-Hartman Date: Mon, 19 Jun 2023 07:51:29 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.14.319~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5dbaa854c14692db05be6161897e49d2ce454fa5;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch mips-prefer-cc-option-for-additions-to-cflags.patch x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch --- diff --git a/queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch b/queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch new file mode 100644 index 00000000000..7d9ce4f2f8a --- /dev/null +++ b/queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch @@ -0,0 +1,94 @@ +From nathan@kernel.org Wed Jun 14 20:04:43 2023 +From: Nathan Chancellor +Date: Wed, 14 Jun 2023 11:04:38 -0700 +Subject: kbuild: Update assembler calls to use proper flags and language target +To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com +Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Masahiro Yamada , Nathan Chancellor , Linux Kernel Functional Testing , Anders Roxell +Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-4-75605d553401@kernel.org> + +From: Nick Desaulniers + +commit d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0 upstream. + +as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can +cause as-option to fail unexpectedly when CONFIG_WERROR is set, because +clang will emit -Werror,-Wunused-command-line-argument for various -m +and -f flags in KBUILD_CFLAGS for assembler sources. + +Callers of as-option and as-instr should be adding flags to +KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use +KBUILD_AFLAGS in all macros to clear up the initial problem. + +Unfortunately, -Wunused-command-line-argument can still be triggered +with clang by the presence of warning flags or macro definitions because +'-x assembler' is used, instead of '-x assembler-with-cpp', which will +consume these flags. Switch to '-x assembler-with-cpp' in places where +'-x assembler' is used, as the compiler is always used as the driver for +out of line assembler sources in the kernel. + +Finally, add -Werror to these macros so that they behave consistently +whether or not CONFIG_WERROR is set. + +[nathan: Reworded and expanded on problems in commit message + Use '-x assembler-with-cpp' in a couple more places] + +Link: https://github.com/ClangBuiltLinux/linux/issues/1699 +Suggested-by: Masahiro Yamada +Signed-off-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Tested-by: Linux Kernel Functional Testing +Tested-by: Anders Roxell +Signed-off-by: Masahiro Yamada +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + scripts/Kconfig.include | 2 +- + scripts/Makefile.compiler | 8 ++++---- + scripts/as-version.sh | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +--- a/scripts/Kconfig.include ++++ b/scripts/Kconfig.include +@@ -33,7 +33,7 @@ ld-option = $(success,$(LD) -v $(1)) + + # $(as-instr,) + # Return y if the assembler supports , n otherwise +-as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -) ++as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler-with-cpp -o /dev/null -) + + # check if $(CC) and $(LD) exist + $(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found) +--- a/scripts/Makefile.compiler ++++ b/scripts/Makefile.compiler +@@ -29,16 +29,16 @@ try-run = $(shell set -e; \ + fi) + + # as-option +-# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) ++# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,) + + as-option = $(call try-run,\ +- $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2)) + + # as-instr +-# Usage: cflags-y += $(call as-instr,instr,option1,option2) ++# Usage: aflags-y += $(call as-instr,instr,option1,option2) + + as-instr = $(call try-run,\ +- printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) ++ printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3)) + + # __cc-option + # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) +--- a/scripts/as-version.sh ++++ b/scripts/as-version.sh +@@ -45,7 +45,7 @@ orig_args="$@" + # Get the first line of the --version output. + IFS=' + ' +-set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null) ++set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null) + + # Split the line on spaces. + IFS=' ' diff --git a/queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch b/queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch new file mode 100644 index 00000000000..6573e3a55f1 --- /dev/null +++ b/queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch @@ -0,0 +1,49 @@ +From nathan@kernel.org Wed Jun 14 20:04:42 2023 +From: Nathan Chancellor +Date: Wed, 14 Jun 2023 11:04:36 -0700 +Subject: MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option +To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com +Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor , tsbogend@alpha.franken.de, linux-mips@vger.kernel.org +Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-2-75605d553401@kernel.org> + +From: Nathan Chancellor + +This patch is for linux-6.1.y and earlier, it has no direct mainline +equivalent. + +In order to backport commit d5c8d6e0fa61 ("kbuild: Update assembler +calls to use proper flags and language target") to resolve a separate +issue regarding PowerPC, the problem noticed and fixed by +commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate +GAS_HAS_SET_HARDFLOAT") needs to be addressed. Unfortunately, 6.1 and +earlier do not contain commit e4412739472b ("Documentation: raise +minimum supported version of binutils to 2.25"), so it cannot be assumed +that all supported versions of GNU as have support for -msoft-float. + +In order to switch from KBUILD_CFLAGS to KBUILD_AFLAGS in as-option +without consequence, move the '-Wa,-msoft-float' check to cc-option, +including '$(cflags-y)' directly to avoid the issue mentioned in +commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate +GAS_HAS_SET_HARDFLOAT"). + +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- +Cc: tsbogend@alpha.franken.de +Cc: linux-mips@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -109,7 +109,7 @@ endif + # (specifically newer than 2.24.51.20140728) we then also need to explicitly + # set ".set hardfloat" in all files which manipulate floating point registers. + # +-ifneq ($(call as-option,-Wa$(comma)-msoft-float,),) ++ifneq ($(call cc-option,$(cflags-y) -Wa$(comma)-msoft-float,),) + cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float + endif + diff --git a/queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch b/queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch new file mode 100644 index 00000000000..ea6e451c4a6 --- /dev/null +++ b/queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch @@ -0,0 +1,54 @@ +From nathan@kernel.org Wed Jun 14 20:04:43 2023 +From: Nathan Chancellor +Date: Wed, 14 Jun 2023 11:04:37 -0700 +Subject: MIPS: Prefer cc-option for additions to cflags +To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com +Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, "Nathan Chancellor" , "Thomas Bogendoerfer" , "Philippe Mathieu-Daudé" , "Linux Kernel Functional Testing" , "Anders Roxell" , "Masahiro Yamada" +Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-3-75605d553401@kernel.org> + +From: Nathan Chancellor + +commit 337ff6bb8960fdc128cabd264aaea3d42ca27a32 upstream. + +A future change will switch as-option to use KBUILD_AFLAGS instead of +KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause +issues if the flag being tested requires a flag previously added to +KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions +so that the flags are tested properly. + +Signed-off-by: Nathan Chancellor +Acked-by: Thomas Bogendoerfer +Reviewed-by: Nick Desaulniers +Reviewed-by: Philippe Mathieu-Daudé +Tested-by: Linux Kernel Functional Testing +Tested-by: Anders Roxell +Signed-off-by: Masahiro Yamada +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/Makefile | 2 +- + arch/mips/loongson2ef/Platform | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -152,7 +152,7 @@ cflags-y += -fno-stack-check + # + # Avoid this by explicitly disabling that assembler behaviour. + # +-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) ++cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,) + + # + # CPU-dependent compiler/assembler options for optimization. +--- a/arch/mips/loongson2ef/Platform ++++ b/arch/mips/loongson2ef/Platform +@@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -marc + # binutils does not merge support for the flag then we can revisit & remove + # this later - for now it ensures vendor toolchains don't cause problems. + # +-cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) ++cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,) + + # Enable the workarounds for Loongson2f + ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS diff --git a/queue-6.1/scsi-target-core-fix-error-path-in-target_setup_session.patch b/queue-6.1/scsi-target-core-fix-error-path-in-target_setup_session.patch index 6e374dc1024..c265dedce79 100644 --- a/queue-6.1/scsi-target-core-fix-error-path-in-target_setup_session.patch +++ b/queue-6.1/scsi-target-core-fix-error-path-in-target_setup_session.patch @@ -23,14 +23,12 @@ Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- - drivers/target/target_core_transport.c | 2 ++ + drivers/target/target_core_transport.c | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c -index 86adff2a86ed..687adc9e086c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c -@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_group *tpg, +@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_gr free_sess: transport_free_session(sess); @@ -39,6 +37,3 @@ index 86adff2a86ed..687adc9e086c 100644 free_cnt: target_free_cmd_counter(cmd_cnt); return ERR_PTR(rc); --- -2.41.0 - diff --git a/queue-6.1/series b/queue-6.1/series index 69fb78b8a79..c3d788f8df5 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -160,3 +160,7 @@ revert-net-sched-act_api-move-tca_ext_warn_msg-to-the-correct-hierarchy.patch net-sched-act_api-add-specific-ext_warn_msg-for-tc-action.patch neighbour-delete-neigh_lookup_nodev-as-not-used.patch scsi-target-core-fix-error-path-in-target_setup_session.patch +x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch +mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch +mips-prefer-cc-option-for-additions-to-cflags.patch +kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch diff --git a/queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch b/queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch new file mode 100644 index 00000000000..48695d32223 --- /dev/null +++ b/queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch @@ -0,0 +1,46 @@ +From nathan@kernel.org Wed Jun 14 20:04:41 2023 +From: Nathan Chancellor +Date: Wed, 14 Jun 2023 11:04:35 -0700 +Subject: x86/boot/compressed: prefer cc-option for CFLAGS additions +To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com +Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Masahiro Yamada , Nathan Chancellor , Linux Kernel Functional Testing , Anders Roxell +Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-1-75605d553401@kernel.org> + +From: Nick Desaulniers + +commit 994f5f7816ff963f49269cfc97f63cb2e4edb84f upstream. + +as-option tests new options using KBUILD_CFLAGS, which causes problems +when using as-option to update KBUILD_AFLAGS because many compiler +options are not valid assembler options. + +This will be fixed in a follow up patch. Before doing so, move the +assembler test for -Wa,-mrelax-relocations=no from using as-option to +cc-option. + +Link: https://lore.kernel.org/llvm/CAK7LNATcHt7GcXZ=jMszyH=+M_LC9Qr6yeAGRCBbE6xriLxtUQ@mail.gmail.com/ +Suggested-by: Masahiro Yamada +Reviewed-by: Nathan Chancellor +Tested-by: Nathan Chancellor +Signed-off-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Tested-by: Linux Kernel Functional Testing +Tested-by: Anders Roxell +Signed-off-by: Masahiro Yamada +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/boot/compressed/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/boot/compressed/Makefile ++++ b/arch/x86/boot/compressed/Makefile +@@ -50,7 +50,7 @@ KBUILD_CFLAGS += $(call cc-option,-fmacr + KBUILD_CFLAGS += -fno-asynchronous-unwind-tables + KBUILD_CFLAGS += -D__DISABLE_EXPORTS + # Disable relocation relaxation in case the link is not PIE. +-KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) ++KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no) + KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h + + # sev.c indirectly inludes inat-table.h which is generated during