linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM; fix cpu_v7_bugs_init reference
@ 2018-05-29 10:22 Arnd Bergmann
  2018-05-29 10:25 ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2018-05-29 10:22 UTC (permalink / raw)
  To: Russell King, Florian Fainelli
  Cc: Arnd Bergmann, Marc Zyngier, linux-arm-kernel, linux-kernel

The cpu_v7_bugs_init() function is referenced by the ARMv7 processor
implementation, but is defined conditionally, leading to a link error when
CONFIG_HARDEN_BRANCH_PREDICTOR is disabled:

arch/arm/mm/proc-v7.o:(.init.data+0xc): undefined reference to `cpu_v7_bugs_init'
arch/arm/mm/proc-v7.o:(.init.data+0x74): undefined reference to `cpu_v7_bugs_init'
arch/arm/mm/proc-v7-bugs.o: In function `cpu_v7_ca8_ibe':
proc-v7-bugs.c:(.text+0x14): undefined reference to `cpu_v7_bugs_init'
arch/arm/mm/proc-v7-bugs.o: In function `cpu_v7_ca15_ibe':
proc-v7-bugs.c:(.text+0x30): undefined reference to `cpu_v7_bugs_init'

There is a '.weak' directive for this symbol, which was apparently
intended to avoid the problem, but the file is lacking an actual global
definition for the function, so it has no effect.

This adds an empty function definition for it, which can now get used
as the fallback.

Fixes: 8d9267cedb9e ("ARM: spectre-v2: harden user aborts in kernel space")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mm/proc-v7.S | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 6fe52819e014..8f980e8b0867 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -547,6 +547,11 @@ __v7_setup_stack_ptr:
 	.word	PHYS_RELATIVE(__v7_setup_stack, .)
 ENDPROC(__v7_setup)
 
+	.weak cpu_v7_bugs_init
+ENTRY(cpu_v7_bugs_init)
+	ret	lr
+ENDPROC(cpu_v7_bugs_init)
+
 	.bss
 	.align	2
 __v7_setup_stack:
@@ -554,8 +559,6 @@ __v7_setup_stack:
 
 	__INITDATA
 
-	.weak cpu_v7_bugs_init
-
 	@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
 	define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_bugs_init
 
-- 
2.9.0

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

* Re: [PATCH] ARM; fix cpu_v7_bugs_init reference
  2018-05-29 10:22 [PATCH] ARM; fix cpu_v7_bugs_init reference Arnd Bergmann
@ 2018-05-29 10:25 ` Russell King - ARM Linux
  2018-05-29 10:46   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2018-05-29 10:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Florian Fainelli, Marc Zyngier, linux-arm-kernel, linux-kernel

Please revalidate against the latest patches, this area has changed.

On Tue, May 29, 2018 at 12:22:06PM +0200, Arnd Bergmann wrote:
> The cpu_v7_bugs_init() function is referenced by the ARMv7 processor
> implementation, but is defined conditionally, leading to a link error when
> CONFIG_HARDEN_BRANCH_PREDICTOR is disabled:
> 
> arch/arm/mm/proc-v7.o:(.init.data+0xc): undefined reference to `cpu_v7_bugs_init'
> arch/arm/mm/proc-v7.o:(.init.data+0x74): undefined reference to `cpu_v7_bugs_init'
> arch/arm/mm/proc-v7-bugs.o: In function `cpu_v7_ca8_ibe':
> proc-v7-bugs.c:(.text+0x14): undefined reference to `cpu_v7_bugs_init'
> arch/arm/mm/proc-v7-bugs.o: In function `cpu_v7_ca15_ibe':
> proc-v7-bugs.c:(.text+0x30): undefined reference to `cpu_v7_bugs_init'
> 
> There is a '.weak' directive for this symbol, which was apparently
> intended to avoid the problem, but the file is lacking an actual global
> definition for the function, so it has no effect.
> 
> This adds an empty function definition for it, which can now get used
> as the fallback.
> 
> Fixes: 8d9267cedb9e ("ARM: spectre-v2: harden user aborts in kernel space")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/mm/proc-v7.S | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
> index 6fe52819e014..8f980e8b0867 100644
> --- a/arch/arm/mm/proc-v7.S
> +++ b/arch/arm/mm/proc-v7.S
> @@ -547,6 +547,11 @@ __v7_setup_stack_ptr:
>  	.word	PHYS_RELATIVE(__v7_setup_stack, .)
>  ENDPROC(__v7_setup)
>  
> +	.weak cpu_v7_bugs_init
> +ENTRY(cpu_v7_bugs_init)
> +	ret	lr
> +ENDPROC(cpu_v7_bugs_init)
> +
>  	.bss
>  	.align	2
>  __v7_setup_stack:
> @@ -554,8 +559,6 @@ __v7_setup_stack:
>  
>  	__INITDATA
>  
> -	.weak cpu_v7_bugs_init
> -
>  	@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
>  	define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1, bugs=cpu_v7_bugs_init
>  
> -- 
> 2.9.0
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

* Re: [PATCH] ARM; fix cpu_v7_bugs_init reference
  2018-05-29 10:25 ` Russell King - ARM Linux
@ 2018-05-29 10:46   ` Arnd Bergmann
  2018-05-29 10:52     ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2018-05-29 10:46 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Florian Fainelli, Marc Zyngier, Linux ARM, Linux Kernel Mailing List

On Tue, May 29, 2018 at 12:25 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> Please revalidate against the latest patches, this area has changed.

Ok. I assume they will be in tomorrow's linux-next kernel?
I'll just wait for that then. Unfortunately there was no linux-next
release yesterday, so I'm still testing on last Friday's code.

      Arnd

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

* Re: [PATCH] ARM; fix cpu_v7_bugs_init reference
  2018-05-29 10:46   ` Arnd Bergmann
@ 2018-05-29 10:52     ` Russell King - ARM Linux
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2018-05-29 10:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Florian Fainelli, Marc Zyngier, Linux ARM, Linux Kernel Mailing List

On Tue, May 29, 2018 at 12:46:00PM +0200, Arnd Bergmann wrote:
> On Tue, May 29, 2018 at 12:25 PM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > Please revalidate against the latest patches, this area has changed.
> 
> Ok. I assume they will be in tomorrow's linux-next kernel?
> I'll just wait for that then. Unfortunately there was no linux-next
> release yesterday, so I'm still testing on last Friday's code.

The patches are already pushed out in my for-next branch as of about
half an hour ago.  If that results in them appearing in linux-next
during the next 24 hours, then yes.  Look for this commit:

0fb1e7b0a396 ("ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1")

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

end of thread, other threads:[~2018-05-29 10:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 10:22 [PATCH] ARM; fix cpu_v7_bugs_init reference Arnd Bergmann
2018-05-29 10:25 ` Russell King - ARM Linux
2018-05-29 10:46   ` Arnd Bergmann
2018-05-29 10:52     ` Russell King - ARM Linux

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).