[PATCH stable 5.4 03/11] ARM: 8971/1: replace the sole use of a symbol with its definition

1 view
Skip to first unread message

Florian Fainelli

unread,
Jun 29, 2022, 2:02:45 PM6/29/22
to sta...@vger.kernel.org, Jian Cai, Nick Desaulniers, Russell King, Florian Fainelli, Russell King, Herbert Xu, David S. Miller, Tony Lindgren, Hans Ulli Kroll, Ard Biesheuvel, Stefan Agner, Nicolas Pitre, Andre Przywara, Greg Kroah-Hartman, Catalin Marinas, moderated list:ARM PORT, open list, open list:CRYPTO API, open list:OMAP2+ SUPPORT, open list:CLANG/LLVM BUILD SUPPORT, Sasha Levin
From: Jian Cai <caij...@gmail.com>

commit a780e485b5768e78aef087502499714901b68cc4 upstream

ALT_UP_B macro sets symbol up_b_offset via .equ to an expression
involving another symbol. The macro gets expanded twice when
arch/arm/kernel/sleep.S is assembled, creating a scenario where
up_b_offset is set to another expression involving symbols while its
current value is based on symbols. LLVM integrated assembler does not
allow such cases, and based on the documentation of binutils, "Values
that are based on expressions involving other symbols are allowed, but
some targets may restrict this to only being done once per assembly", so
it may be better to avoid such cases as it is not clearly stated which
targets should support or disallow them. The fix in this case is simple,
as up_b_offset has only one use, so we can replace the use with the
definition and get rid of up_b_offset.

Link:https://github.com/ClangBuiltLinux/linux/issues/920

Reviewed-by: Stefan Agner <ste...@agner.ch>

Reviewed-by: Nick Desaulniers <ndesau...@google.com>
Signed-off-by: Jian Cai <caij...@gmail.com>
Signed-off-by: Russell King <rmk+k...@armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fai...@gmail.com>
---
arch/arm/include/asm/assembler.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 6b3e64e19fb6..70e1c23feedb 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -279,10 +279,9 @@
.endif ;\
.popsection
#define ALT_UP_B(label) \
- .equ up_b_offset, label - 9998b ;\
.pushsection ".alt.smp.init", "a" ;\
.long 9998b ;\
- W(b) . + up_b_offset ;\
+ W(b) . + (label - 9998b) ;\
.popsection
#else
#define ALT_SMP(instr...)
--
2.25.1

gre...@linuxfoundation.org

unread,
Jun 30, 2022, 9:29:53 AM6/30/22
to andre.p...@arm.com, ar...@kernel.org, caij...@gmail.com, catalin...@arm.com, clang-bu...@googlegroups.com, da...@davemloft.net, f.fai...@gmail.com, gre...@linuxfoundation.org, her...@gondor.apana.org.au, linux-ar...@lists.infradead.org, li...@armlinux.org.uk, ndesau...@google.com, ni...@fluxnic.net, rmk+k...@armlinux.org.uk, sas...@kernel.org, ste...@agner.ch, to...@atomide.com, ulli....@googlemail.com, stable-...@vger.kernel.org

This is a note to let you know that I've just added the patch titled

ARM: 8971/1: replace the sole use of a symbol with its definition

to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm-8971-1-replace-the-sole-use-of-a-symbol-with-its-definition.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <sta...@vger.kernel.org> know about it.


From foo@baz Thu Jun 30 03:27:07 PM CEST 2022
From: Florian Fainelli <f.fai...@gmail.com>
Date: Wed, 29 Jun 2022 11:02:19 -0700
Subject: ARM: 8971/1: replace the sole use of a symbol with its definition
To: sta...@vger.kernel.org
Cc: Jian Cai <caij...@gmail.com>, Nick Desaulniers <ndesau...@google.com>, Russell King <rmk+k...@armlinux.org.uk>, Florian Fainelli <f.fai...@gmail.com>, Russell King <li...@armlinux.org.uk>, Herbert Xu <her...@gondor.apana.org.au>, "David S. Miller" <da...@davemloft.net>, Tony Lindgren <to...@atomide.com>, Hans Ulli Kroll <ulli....@googlemail.com>, Ard Biesheuvel <ar...@kernel.org>, Stefan Agner <ste...@agner.ch>, Nicolas Pitre <ni...@fluxnic.net>, Andre Przywara <andre.p...@arm.com>, Greg Kroah-Hartman <gre...@linuxfoundation.org>, Catalin Marinas <catalin...@arm.com>, linux-ar...@lists.infradead.org (moderated list:ARM PORT), linux-...@vger.kernel.org (open list), linux-...@vger.kernel.org (open list:CRYPTO API), linux...@vger.kernel.org (open list:OMAP2+ SUPPORT), clang-bu...@googlegroups.com (open list:CLANG/LLVM BUILD SUPPORT), Sasha Levin <sas...@kernel.org>
Message-ID: <20220629180227.34...@gmail.com>

From: Jian Cai <caij...@gmail.com>

commit a780e485b5768e78aef087502499714901b68cc4 upstream

ALT_UP_B macro sets symbol up_b_offset via .equ to an expression
involving another symbol. The macro gets expanded twice when
arch/arm/kernel/sleep.S is assembled, creating a scenario where
up_b_offset is set to another expression involving symbols while its
current value is based on symbols. LLVM integrated assembler does not
allow such cases, and based on the documentation of binutils, "Values
that are based on expressions involving other symbols are allowed, but
some targets may restrict this to only being done once per assembly", so
it may be better to avoid such cases as it is not clearly stated which
targets should support or disallow them. The fix in this case is simple,
as up_b_offset has only one use, so we can replace the use with the
definition and get rid of up_b_offset.

Link:https://github.com/ClangBuiltLinux/linux/issues/920

Reviewed-by: Stefan Agner <ste...@agner.ch>

Reviewed-by: Nick Desaulniers <ndesau...@google.com>
Signed-off-by: Jian Cai <caij...@gmail.com>
Signed-off-by: Russell King <rmk+k...@armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fai...@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
arch/arm/include/asm/assembler.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -279,10 +279,9 @@
.endif ;\
.popsection
#define ALT_UP_B(label) \
- .equ up_b_offset, label - 9998b ;\
.pushsection ".alt.smp.init", "a" ;\
.long 9998b ;\
- W(b) . + up_b_offset ;\
+ W(b) . + (label - 9998b) ;\
.popsection
#else
#define ALT_SMP(instr...)


Patches currently in stable-queue which might be from f.fai...@gmail.com are

queue-5.4/arm-8971-1-replace-the-sole-use-of-a-symbol-with-its-definition.patch
queue-5.4/arm-omap2-drop-unnecessary-adrl.patch
queue-5.4/arm-8933-1-replace-sun-solaris-style-flag-on-section-directive.patch
queue-5.4/crypto-arm-sha256-neon-avoid-adrl-pseudo-instruction.patch
queue-5.4/arm-9029-1-make-iwmmxt.s-support-clang-s-integrated-assembler.patch
queue-5.4/net-mscc-ocelot-allow-unregistered-ip-multicast-flooding.patch
queue-5.4/crypto-arm-sha512-neon-avoid-adrl-pseudo-instruction.patch
queue-5.4/arm-8989-1-use-.fpu-assembler-directives-instead-of-assembler-arguments.patch
queue-5.4/crypto-arm-ghash-ce-define-fpu-before-fpu-registers-are-referenced.patch
queue-5.4/arm-8929-1-use-apsr_nzcv-instead-of-r15-as-mrc-operand.patch
queue-5.4/crypto-arm-use-kconfig-based-compiler-checks-for-crypto-opcodes.patch
queue-5.4/arm-8990-1-use-vfp-assembler-mnemonics-in-register-load-store-macros.patch
Reply all
Reply to author
Forward
0 new messages