ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
PATCH 1/1 ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the assembler could generate non-naturally-aligned v7wbi_tlb_fns which results in a boot failure. The original commit adding the macro missed the .align directive on this data.
--- arch/arm/Kconfig | 1 + arch/arm/mm/proc-macros.S | 1 + 2 files changed, 2 insertions(+)
arch/arm/Kconfig +1 -0
@@ -92,6 +92,7 @@ config ARM select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_IRQ_TIME_ACCOUNTING
arch/arm/mm/proc-macros.S +1 -0
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_range
Signature · 1 line
2.33.0.685.g46640cef36-goog
+ Dave (Dave, I got a bounceback on your linaro.org email address. Consider sending a patch updating the .mailmap)
Quoted 47 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with
CONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mm/proc-macros.S | 1 + 2 files changed, 2 insertions(+)arch/arm/Kconfig +1
-0@@ -92,6 +92,7 @@ config ARM select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_IRQ_TIME_ACCOUNTINGarch/arm/mm/proc-macros.S +1
-1@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_range --2.33.0.685.g46640cef36-goog
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 23 lines · Nick Desaulniers
+ Dave (Dave, I got a bounceback on your linaro.org email address. Consider sending a patch updating the .mailmap)
Quoted 17 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with
CONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arm/Kconfig | 1 +
d'oh, had an unintentional -a when I did git commit. Will resend a v2...
Quoted 35 lines
Quoted 28 lines
arch/arm/mm/proc-macros.S | 1 + 2 files changed, 2 insertions(+)arch/arm/Kconfig +1
-0@@ -92,6 +92,7 @@ config ARM select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_IRQ_TIME_ACCOUNTINGarch/arm/mm/proc-macros.S +1
-1@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_range --Quoted 2 lines
2.33.0.685.g46640cef36-goog
--
Thanks,
~Nick Desaulniers
Signature · 2 lines
Thanks, ~Nick Desaulniers
PATCH v2 1/1 ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the assembler could generate non-naturally-aligned v7wbi_tlb_fns which results in a boot failure. The original commit adding the macro missed the .align directive on this data.
---
Changes V1 -> V2:
* Drop accidentally committed Kconfig change.
* Pick up Ard's AB tag.
arch/arm/mm/proc-macros.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/mm/proc-macros.S +1 -0
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_range
base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
Signature · 1 line
2.33.0.685.g46640cef36-goog
Quoted 6 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with
CONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.
Quoted 9 lines
Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>
Quoted 27 lines
---
Changes V1 -> V2:
* Drop accidentally committedKconfigchange.
* Pick up Ard's AB tag.arch/arm/mm/proc-macros.S | 1 + 1 file changed, 1 insertion(+)arch/arm/mm/proc-macros.S +1
-0@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_rangebase-commit:
02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id:3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0Signature · 1 line
2.33.0.685.g46640cef36-goog
Quoted 2 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses.
Btw, this is not entirely relevant. QEMU now behaves like every single hardware implementation does, and reports an alignment fault when using a load-multiple instruction on an address that is not 32-bit aligned, as the architecture requires.
Quoted 41 lines
A
kernel built withCONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>---
Changes V1 -> V2:
* Drop accidentally committedKconfigchange.
* Pick up Ard's AB tag.arch/arm/mm/proc-macros.S | 1 + 1 file changed, 1 insertion(+)arch/arm/mm/proc-macros.S +1
-0@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_rangebase-commit:
02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id:3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0--
2.33.0.685.g46640cef36-goog
Quoted 9 lines · Ard Biesheuvel
Quoted 2 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses.
Btw, this is not entirely relevant. QEMU now behaves like every single hardware implementation does, and reports an alignment fault when using a load-multiple instruction on an address that is not 32-bit aligned, as the architecture requires.
Sure, I can drop that line from the commit message when submitting to RMK's queue.
Quoted 43 lines
Quoted 43 lines
A
kernel built withCONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>---
Changes V1 -> V2:
* Drop accidentally committedKconfigchange.
* Pick up Ard's AB tag.arch/arm/mm/proc-macros.S | 1 + 1 file changed, 1 insertion(+)arch/arm/mm/proc-macros.S +1
-0@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_rangebase-commit:
02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id:3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0--
2.33.0.685.g46640cef36-goog
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 25 lines · Nick Desaulniers
QEMU 6.1.0 is more correct about trapping on misaligned accesses. A kernel built with
CONFIG_THUMB2_KERNEL=yand using clang as the assembler could generate non-naturally-alignedv7wbi_tlb_fnswhich results in a boot failure. The original commit adding the macro missed the .align directive on this data.Fixes 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")Debugged-by Ard Biesheuvel <[email protected]>Debugged-by Nathan Chancellor <[email protected]>Debugged-by Richard Henderson <[email protected]>Suggested-by Ard Biesheuvel <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mm/proc-macros.S | 1 + 2 files changed, 2 insertions(+)arch/arm/Kconfig +0
-0
arch/arm/Kconfig config ARM · line 98
Quoted 7 lines
arch/arm/Kconfig +1
-0@@ -92,6 +92,7 @@ config ARM select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) select HAVE_IRQ_TIME_ACCOUNTING
I take it this hunk got included by accident?
Quoted 13 lines
arch/arm/mm/proc-macros.S +1
-1@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns) .macro define_tlb_functions name:req, flags_up:req, flags_smp .type \name\()_tlb_fns, #object + .align 2 ENTRY(\name\()_tlb_fns) .long \name\()_flush_user_tlb_range .long \name\()_flush_kern_tlb_range --
Quoted 2 lines
2.33.0.685.g46640cef36-goog
For this part,