Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: entry: word-align the syscall table
@ 2026-09-22  8:07 Yenchia Chen
  0 siblings, 0 replies; only message in thread
From: Yenchia Chen @ 2026-09-22  8:07 UTC (permalink / raw)
  To: Russell King
  Cc: Yenchia Chen, Huang-Sen Lin, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-arm-kernel, linux-kernel,
	linux-mediatek

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.

Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com>
Signed-off-by: Huang-Sen Lin <eddy.lin@mediatek.com>
---
 arch/arm/kernel/entry-common.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 88336a1292bb..831a40461cdf 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -321,6 +321,7 @@ __sys_trace_return:
 	.macro	syscall_table_start, sym
 	.equ	__sys_nr, 0
 	.type	\sym, #object
+	.align	2
 ENTRY(\sym)
 	.endm
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-22  8:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22  8:07 [PATCH] ARM: entry: word-align the syscall table Yenchia Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox