Skip to contentSkip to conversation

arm64: Fix size of __early_cpu_boot_status

PATCH Arun KS 4 participants 4 messages Apr 30, 2019 – May 1, 2019 arm64

lore
Share & tools
lore

Arun KS

author
#0 lore raw

__early_cpu_boot_status is of type long. Use quad
assembler directive to allocate proper size.

---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/head.S +1 -1
index eecf792..115f332 100644
@@ -684,7 +684,7 @@ ENTRY(__boot_cpu_mode)
  * with MMU turned off.
  */
 ENTRY(__early_cpu_boot_status)
-	.long 	0
+	.quad 	0
 
 	.popsection
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 13 lines · Arun KS

__early_cpu_boot_status is of type long. Use quad
assembler directive to allocate proper size.

---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/head.S +0 -0
index eecf792..115f332 100644

arch/arm64/kernel/head.S ENTRY(__boot_cpu_mode) · line 687

Quoted 5 lines
arch/arm64/kernel/head.S +1 -1
@@ -684,7 +684,7 @@ ENTRY(__boot_cpu_mode)
  * with MMU turned off.
  */
 ENTRY(__early_cpu_boot_status)
-	.long 	0
+	.quad 	0

Yikes. How did you spot this? Did we end up corrupting an adjacent variable, or does the alignment in the linker script save us in practice?

Will

#2 lore raw
Quoted 10 lines · Will Deacon
Quoted 8 lines · Arun KS

__early_cpu_boot_status is of type long. Use quad
assembler directive to allocate proper size.

---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

arch/arm64/kernel/head.S ENTRY(__boot_cpu_mode) · line 687

Quoted 10 lines
arch/arm64/kernel/head.S +1 -1
index eecf792..115f332 100644
@@ -684,7 +684,7 @@ ENTRY(__boot_cpu_mode)
  * with MMU turned off.
  */
 ENTRY(__early_cpu_boot_status)
-     .long   0
+     .quad   0

Yikes. How did you spot this? Did we end up corrupting an adjacent variable, or does the alignment in the linker script save us in practice?

Rite now there is no adjacent variable. But I was adding one and it was getting corrupted.

Regards,
Arun

Quoted 2 lines

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer Acked-by
#3 lore raw
In reply to Arun KS
Quoted 13 lines · Arun KS

__early_cpu_boot_status is of type long. Use quad
assembler directive to allocate proper size.

---
 arch/arm64/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/head.S +0 -0
index eecf792..115f332 100644

arch/arm64/kernel/head.S ENTRY(__boot_cpu_mode) · line 687

Quoted 5 lines
arch/arm64/kernel/head.S +1 -1
@@ -684,7 +684,7 @@ ENTRY(__boot_cpu_mode)
  * with MMU turned off.
  */
 ENTRY(__early_cpu_boot_status)
-	.long 	0
+	.quad 	0

This is the last element in .mmuoff.data.write, which is padded to 2K, so luckily we don't clobber anything else (and don't need a backport).

For consistency with __boot_cpu_mode, we could instead change the c declaration to int, and fix up the calls to update_early_cpu_boot_status, to use a w register, but either way:

Mark.

Quoted 11 lines
arch/arm64/kernel/head.S +0 -0
 	.popsection
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel