* [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
@ 2026-07-09 7:28 Jinjie Ruan
2026-07-09 7:36 ` Thomas Weißschuh
2026-07-09 7:42 ` sashiko-bot
0 siblings, 2 replies; 4+ messages in thread
From: Jinjie Ruan @ 2026-07-09 7:28 UTC (permalink / raw)
To: chenhuacai, kernel, maddy, mpe, npiggin, chleroy, pjw, palmer,
aou, alex, hca, gor, agordeev, borntraeger, svens, tglx, mingo,
bp, dave.hansen, hpa, nathan, kees, xur, peterz, gourry,
lukas.bulwahn, ryan.roberts, ruanjinjie, yangtiezhu, sshegde,
mchauras, austin.kim, arnd, jchrist, x86, linux-kernel, loongarch,
linuxppc-dev, linux-riscv, linux-s390
Currently, only x86 genuinely implements and supports Syscall User
Dispatch (SUD). Multiple architectures provide a stub
arch_syscall_is_vdso_sigreturn() returning 'false' simply to satisfy
GENERIC_ENTRY compilation, which creates a false impression of feature
support.
Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH to decouple this mechanism
from GENERIC_ENTRY. Select it exclusively on x86 and remove the redundant
stub functions from other architectures.
Link: https://lore.kernel.org/linux-arm-kernel/akZgV0Y4YAmB43_g@J2N7QTR9R3.cambridge.arm.com/
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
arch/Kconfig | 1 +
arch/loongarch/include/asm/syscall.h | 6 ------
arch/powerpc/include/asm/syscall.h | 5 -----
arch/riscv/include/asm/syscall.h | 5 -----
arch/s390/include/asm/syscall.h | 5 -----
arch/x86/Kconfig | 1 +
6 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 0c01521c2f3f..393d0fb75eac 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -116,6 +116,7 @@ config GENERIC_ENTRY
config SYSCALL_USER_DISPATCH
bool "Syscall User Dispatch"
+ depends on ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
depends on GENERIC_ENTRY
default y
help
diff --git a/arch/loongarch/include/asm/syscall.h b/arch/loongarch/include/asm/syscall.h
index df8ea223c77b..d9275010f548 100644
--- a/arch/loongarch/include/asm/syscall.h
+++ b/arch/loongarch/include/asm/syscall.h
@@ -84,10 +84,4 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_LOONGARCH64;
#endif
}
-
-static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
-{
- return false;
-}
-
#endif /* __ASM_LOONGARCH_SYSCALL_H */
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 834fcc4f7b54..4b3c52ed6e9d 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -139,9 +139,4 @@ static inline int syscall_get_arch(struct task_struct *task)
else
return AUDIT_ARCH_PPC64;
}
-
-static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
-{
- return false;
-}
#endif /* _ASM_SYSCALL_H */
diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
index 8067e666a4ca..987c9a78806f 100644
--- a/arch/riscv/include/asm/syscall.h
+++ b/arch/riscv/include/asm/syscall.h
@@ -112,11 +112,6 @@ static inline void syscall_handler(struct pt_regs *regs, ulong syscall)
regs->a0 = fn(regs);
}
-static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
-{
- return false;
-}
-
asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t);
asmlinkage long sys_riscv_hwprobe(struct riscv_hwprobe *, size_t, size_t,
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 4271e4169f45..5f310caad1fc 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -89,11 +89,6 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_S390X;
}
-static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
-{
- return false;
-}
-
#define SYSCALL_FMT_0
#define SYSCALL_FMT_1 , "0" (r2)
#define SYSCALL_FMT_2 , "d" (r3) SYSCALL_FMT_1
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bdad90f210e4..f3f8ad107eeb 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -335,6 +335,7 @@ config X86
select SCHED_SMT if SMP
select ARCH_SUPPORTS_SCHED_CLUSTER if SMP
select ARCH_SUPPORTS_SCHED_MC if SMP
+ select ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
select HAVE_SINGLE_FTRACE_DIRECT_OPS if X86_64 && DYNAMIC_FTRACE_WITH_DIRECT_CALLS
config INSTRUCTION_DECODER
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
2026-07-09 7:28 [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH Jinjie Ruan
@ 2026-07-09 7:36 ` Thomas Weißschuh
2026-07-09 7:59 ` Jinjie Ruan
2026-07-09 7:42 ` sashiko-bot
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 7:36 UTC (permalink / raw)
To: Jinjie Ruan
Cc: chenhuacai, kernel, maddy, mpe, npiggin, chleroy, pjw, palmer,
aou, alex, hca, gor, agordeev, borntraeger, svens, tglx, mingo,
bp, dave.hansen, hpa, nathan, kees, xur, peterz, gourry,
lukas.bulwahn, ryan.roberts, yangtiezhu, sshegde, mchauras,
austin.kim, arnd, jchrist, x86, linux-kernel, loongarch,
linuxppc-dev, linux-riscv, linux-s390
On Thu, Jul 09, 2026 at 03:28:03PM +0800, Jinjie Ruan wrote:
> Currently, only x86 genuinely implements and supports Syscall User
> Dispatch (SUD). Multiple architectures provide a stub
> arch_syscall_is_vdso_sigreturn() returning 'false' simply to satisfy
> GENERIC_ENTRY compilation, which creates a false impression of feature
> support.
>
> Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH to decouple this mechanism
> from GENERIC_ENTRY. Select it exclusively on x86 and remove the redundant
> stub functions from other architectures.
Nice, this confused me before.
> Link: https://lore.kernel.org/linux-arm-kernel/akZgV0Y4YAmB43_g@J2N7QTR9R3.cambridge.arm.com/
> Cc: Thomas Gleixner <tglx@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Ada Couprie Diaz <ada.coupriediaz@arm.com>
> Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Suggested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
> arch/Kconfig | 1 +
> arch/loongarch/include/asm/syscall.h | 6 ------
> arch/powerpc/include/asm/syscall.h | 5 -----
> arch/riscv/include/asm/syscall.h | 5 -----
> arch/s390/include/asm/syscall.h | 5 -----
> arch/x86/Kconfig | 1 +
> 6 files changed, 2 insertions(+), 21 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 0c01521c2f3f..393d0fb75eac 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -116,6 +116,7 @@ config GENERIC_ENTRY
>
> config SYSCALL_USER_DISPATCH
> bool "Syscall User Dispatch"
> + depends on ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
ARCH_SUPPORTS_SYSCALL_USER_DISPATCH is not declared as a config option,
so the 'select' will not do anything. Needs this:
config ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
bool
> depends on GENERIC_ENTRY
> default y
> help
(...)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
2026-07-09 7:28 [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH Jinjie Ruan
2026-07-09 7:36 ` Thomas Weißschuh
@ 2026-07-09 7:42 ` sashiko-bot
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-07-09 7:42 UTC (permalink / raw)
To: Jinjie Ruan; +Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Critical] The Kconfig symbol `ARCH_SUPPORTS_SYSCALL_USER_DISPATCH` is referenced in `depends on` and `select` but is never defined anywhere, silently disabling Syscall User Dispatch globally.
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but pre-exists in the state restoration logic: tasks that configure Syscall User Dispatch with `PR_SYS_DISPATCH_INCLUSIVE_ON` cannot have their configuration restored via ptrace, breaking Checkpoint/Restore (CRIU).
--
--- Patch [1]: [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH ---
commit 46bd6e141d4dc4cf13cdaf9787b9a2959d21a56a
Author: Jinjie Ruan <ruanjinjie@huawei.com>
syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
This commit introduces ARCH_SUPPORTS_SYSCALL_USER_DISPATCH to decouple
Syscall User Dispatch from GENERIC_ENTRY. It selects the new config
exclusively on x86 and removes redundant stub functions from other
architectures.
Link: https://lore.kernel.org/linux-arm-kernel/akZgV0Y4YAmB43_g@J2N7QTR9R3.cambridge.arm.com/
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 0c01521c2f3f2..393d0fb75eac4 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -116,6 +116,7 @@ config GENERIC_ENTRY
>
> config SYSCALL_USER_DISPATCH
> bool "Syscall User Dispatch"
> + depends on ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
[Severity: Critical]
Does this regression disable Syscall User Dispatch globally? It appears
ARCH_SUPPORTS_SYSCALL_USER_DISPATCH is referenced here but never defined in
any Kconfig file. Since the symbol is undefined, Kconfig evaluates it to
false, which prevents CONFIG_SYSCALL_USER_DISPATCH from being enabled and
could break the userspace ABI where prctl(PR_SET_SYSCALL_USER_DISPATCH)
returns -EINVAL.
> depends on GENERIC_ENTRY
> default y
> help
[ ... ]
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index b5571667a89b2..2bff333d29e84 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -336,6 +336,7 @@ config X86
> select SCHED_SMT if SMP
> select ARCH_SUPPORTS_SCHED_CLUSTER if SMP
> select ARCH_SUPPORTS_SCHED_MC if SMP
> + select ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
[Severity: Critical]
Could this select statement be ineffective? Since
ARCH_SUPPORTS_SYSCALL_USER_DISPATCH is not defined anywhere, selecting it
here has no effect.
> select HAVE_SINGLE_FTRACE_DIRECT_OPS if X86_64 && DYNAMIC_FTRACE_WITH_DIRECT_CALLS
>
> config INSTRUCTION_DECODER
[ ... ]
[Severity: High]
This is a pre-existing issue, but does the state restoration logic break for
tasks configuring Syscall User Dispatch with PR_SYS_DISPATCH_INCLUSIVE_ON?
When a task configures PR_SYS_DISPATCH_INCLUSIVE_ON,
task_set_syscall_user_dispatch() inverts offset and len:
kernel/entry/syscall_user_dispatch.c:task_set_syscall_user_dispatch() {
...
case PR_SYS_DISPATCH_INCLUSIVE_ON:
/* ... */
offset += len;
len = -len;
...
}
However, syscall_user_dispatch_get_config() reads these inverted values but
sets the mode to PR_SYS_DISPATCH_ON (which is EXCLUSIVE_ON), losing the
INCLUSIVE_ON distinction:
kernel/entry/syscall_user_dispatch.c:syscall_user_dispatch_get_config() {
...
if (test_task_syscall_work(task, SYSCALL_USER_DISPATCH))
cfg.mode = PR_SYS_DISPATCH_ON;
else
cfg.mode = PR_SYS_DISPATCH_OFF;
cfg.offset = sd->offset;
cfg.len = sd->len;
...
}
During restoration, task_set_syscall_user_dispatch() evaluates this state
under the EXCLUSIVE_ON branch, where the overflow check rejects the inverted
wrap-around parameters:
kernel/entry/syscall_user_dispatch.c:task_set_syscall_user_dispatch() {
...
case PR_SYS_DISPATCH_EXCLUSIVE_ON:
/* ... */
if (offset && offset + len <= offset)
return -EINVAL;
...
}
Could this cause ptrace(PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG) to
unconditionally fail with -EINVAL for inclusive mode configurations,
breaking Checkpoint/Restore?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709072803.3843948-1-ruanjinjie@huawei.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
2026-07-09 7:36 ` Thomas Weißschuh
@ 2026-07-09 7:59 ` Jinjie Ruan
0 siblings, 0 replies; 4+ messages in thread
From: Jinjie Ruan @ 2026-07-09 7:59 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: chenhuacai, kernel, maddy, mpe, npiggin, chleroy, pjw, palmer,
aou, alex, hca, gor, agordeev, borntraeger, svens, tglx, mingo,
bp, dave.hansen, hpa, nathan, kees, xur, peterz, gourry,
lukas.bulwahn, ryan.roberts, yangtiezhu, sshegde, mchauras,
austin.kim, arnd, jchrist, x86, linux-kernel, loongarch,
linuxppc-dev, linux-riscv, linux-s390
On 7/9/2026 3:36 PM, Thomas Weißschuh wrote:
> On Thu, Jul 09, 2026 at 03:28:03PM +0800, Jinjie Ruan wrote:
>> Currently, only x86 genuinely implements and supports Syscall User
>> Dispatch (SUD). Multiple architectures provide a stub
>> arch_syscall_is_vdso_sigreturn() returning 'false' simply to satisfy
>> GENERIC_ENTRY compilation, which creates a false impression of feature
>> support.
>>
>> Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH to decouple this mechanism
>> from GENERIC_ENTRY. Select it exclusively on x86 and remove the redundant
>> stub functions from other architectures.
>
> Nice, this confused me before.
>
>> Link: https://lore.kernel.org/linux-arm-kernel/akZgV0Y4YAmB43_g@J2N7QTR9R3.cambridge.arm.com/
>> Cc: Thomas Gleixner <tglx@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Ada Couprie Diaz <ada.coupriediaz@arm.com>
>> Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>> Suggested-by: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>> arch/Kconfig | 1 +
>> arch/loongarch/include/asm/syscall.h | 6 ------
>> arch/powerpc/include/asm/syscall.h | 5 -----
>> arch/riscv/include/asm/syscall.h | 5 -----
>> arch/s390/include/asm/syscall.h | 5 -----
>> arch/x86/Kconfig | 1 +
>> 6 files changed, 2 insertions(+), 21 deletions(-)
>>
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 0c01521c2f3f..393d0fb75eac 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -116,6 +116,7 @@ config GENERIC_ENTRY
>>
>> config SYSCALL_USER_DISPATCH
>> bool "Syscall User Dispatch"
>> + depends on ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
>
> ARCH_SUPPORTS_SYSCALL_USER_DISPATCH is not declared as a config option,
> so the 'select' will not do anything. Needs this:
>
> config ARCH_SUPPORTS_SYSCALL_USER_DISPATCH
> bool
Yes, this is missing here.
>
>> depends on GENERIC_ENTRY
>> default y
>> help
>
> (...)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-09 7:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 7:28 [PATCH] syscall_user_dispatch: Introduce ARCH_SUPPORTS_SYSCALL_USER_DISPATCH Jinjie Ruan
2026-07-09 7:36 ` Thomas Weißschuh
2026-07-09 7:59 ` Jinjie Ruan
2026-07-09 7:42 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox