Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yenchia Chen <yenchia.chen@mediatek.com>
To: Russell King <linux@armlinux.org.uk>
Cc: Yenchia Chen <yenchia.chen@mediatek.com>,
	Huang-Sen Lin <eddy.lin@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>
Subject: [PATCH] ARM: entry: word-align the syscall table
Date: Tue, 22 Sep 2026 16:07:38 +0800	[thread overview]
Message-ID: <20260922080744.798430-1-yenchia.chen@mediatek.com> (raw)

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



                 reply	other threads:[~2026-09-22  8:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260922080744.798430-1-yenchia.chen@mediatek.com \
    --to=yenchia.chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=eddy.lin@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox