* [PATCH] m68k: syscall: fix syscall_get_arguments() argument mapping
@ 2026-05-29 9:40 Yiqi Sun
2026-05-29 22:52 ` Michael Schmitz
0 siblings, 1 reply; 2+ messages in thread
From: Yiqi Sun @ 2026-05-29 9:40 UTC (permalink / raw)
To: linux-m68k, geert; +Cc: linux-kernel, Yiqi Sun
On m68k, syscall_get_arguments() currently returns orig_d0 as args[0],
followed by d1-d5 as args[1..5].
However, syscall arguments are passed in d1-d5 and a0, so args[0]
should reflect d1, and the full argument set should include a0.
Fix the mapping by copying all six arguments from the saved register
block starting at d1.
Fixes: 6baaade15594 ("m68k: Add kernel seccomp support")
Signed-off-by: Yiqi Sun <sunyiqixm@gmail.com>
---
arch/m68k/include/asm/syscall.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
index bf84b160c2eb..2e268eeedad3 100644
--- a/arch/m68k/include/asm/syscall.h
+++ b/arch/m68k/include/asm/syscall.h
@@ -52,10 +52,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned long *args)
{
- args[0] = regs->orig_d0;
- args++;
-
- memcpy(args, ®s->d1, 5 * sizeof(args[0]));
+ memcpy(args, ®s->d1, 6 * sizeof(args[0]));
}
static inline void syscall_set_arguments(struct task_struct *task,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] m68k: syscall: fix syscall_get_arguments() argument mapping
2026-05-29 9:40 [PATCH] m68k: syscall: fix syscall_get_arguments() argument mapping Yiqi Sun
@ 2026-05-29 22:52 ` Michael Schmitz
0 siblings, 0 replies; 2+ messages in thread
From: Michael Schmitz @ 2026-05-29 22:52 UTC (permalink / raw)
To: Yiqi Sun, linux-m68k, geert; +Cc: linux-kernel
Yiqi,
thanks for your patch!
On 29/05/2026 9:40 PM, Yiqi Sun wrote:
> On m68k, syscall_get_arguments() currently returns orig_d0 as args[0],
> followed by d1-d5 as args[1..5].
From my reading of other arch's syscall.h code at the time the patch
was written, the syscall nr passed in d0 appeared to be considered the
first argument to be returned. It now appears that that was incorrect -
I don't suppose the semantics of this function changed over the past
three years?
m68k seccomp support was rather incomplete back then, and I've seen more
contributions recently. Does this cause any regressions or improvements
to the seccomp_bpf tests or other test results?
>
> However, syscall arguments are passed in d1-d5 and a0, so args[0]
> should reflect d1, and the full argument set should include a0.
>
> Fix the mapping by copying all six arguments from the saved register
> block starting at d1.
>
> Fixes: 6baaade15594 ("m68k: Add kernel seccomp support")
> Signed-off-by: Yiqi Sun <sunyiqixm@gmail.com>
> ---
> arch/m68k/include/asm/syscall.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
> index bf84b160c2eb..2e268eeedad3 100644
> --- a/arch/m68k/include/asm/syscall.h
> +++ b/arch/m68k/include/asm/syscall.h
> @@ -52,10 +52,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
> struct pt_regs *regs,
> unsigned long *args)
> {
> - args[0] = regs->orig_d0;
> - args++;
> -
> - memcpy(args, ®s->d1, 5 * sizeof(args[0]));
> + memcpy(args, ®s->d1, 6 * sizeof(args[0]));
> }
>
> static inline void syscall_set_arguments(struct task_struct *task,
Any reason for not applying the same change to syscall_set_arguments() here?
Cheers,
Michael
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-29 22:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 9:40 [PATCH] m68k: syscall: fix syscall_get_arguments() argument mapping Yiqi Sun
2026-05-29 22:52 ` Michael Schmitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox