Skip to contentSkip to conversation

ARM: entry: word-align the syscall table

PATCH New Yenchia Chen 1 participant 1 message Sep 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: entry: word-align the syscall table

On ARM, ENTRY is .align 0 and nothing else aligns the table. It is layout-dependent and left to chance that unrelated code (e.g. CONFIG_TRACE_IRQFLAGS fast path in entry-common.S) can shift the table on or off a word boundary since Thumb-2 has 2-byte instructions. The syscall dispatch loads the handler with

        ldr pc, [tbl, scno, lsl #2]

which requires the table base to be word-aligned. Observed on our platform, the first syscall loads pc from an unaligned address and takes a fatal alignment exception:

        Alignment trap: not handling instruction f858f02a at [<c0100208>]
        Unhandled fault: alignment exception (0x001) at 0xc01002ba
        Internal error: : 1 [#1] PREEMPT SMP THUMB2

Align the table in syscall_table_start so it is always word-aligned regardless of THUMB2 layout.

---
 arch/arm/kernel/entry-common.S | 1 +
 1 file changed, 1 insertion(+)
arch/arm/kernel/entry-common.S +1 -0
index 88336a1292bb..831a40461cdf 100644
@@ -321,6 +321,7 @@ __sys_trace_return:
 	.macro	syscall_table_start, sym
 	.equ	__sys_nr, 0
 	.type	\sym, #object
+	.align	2
 ENTRY(\sym)
 	.endm
 
Signature · 1 line
2.45.2