[PATCH v6 3/6] syscall.h: introduce syscall_set_nr()
Maciej W. Rozycki
macro at orcam.me.uk
Wed Feb 19 17:16:05 UTC 2025
On Mon, 17 Feb 2025, Dmitry V. Levin wrote:
> diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
> index ea050b23d428..b956b015641c 100644
> --- a/arch/mips/include/asm/syscall.h
> +++ b/arch/mips/include/asm/syscall.h
> @@ -41,6 +41,20 @@ static inline long syscall_get_nr(struct task_struct *task,
> return task_thread_info(task)->syscall;
> }
>
> +static inline void syscall_set_nr(struct task_struct *task,
> + struct pt_regs *regs,
> + int nr)
> +{
> + /*
> + * New syscall number has to be assigned to regs[2] because
> + * syscall_trace_entry() loads it from there unconditionally.
That label is called `trace_a_syscall' in arch/mips/kernel/scall64-o32.S
instead. To bring some order and avoid an inaccuracy here should the odd
one be matched to the other three?
> + *
> + * Consequently, if the syscall was indirect and nr != __NR_syscall,
> + * then after this assignment the syscall will cease to be indirect.
> + */
> + task_thread_info(task)->syscall = regs->regs[2] = nr;
> +}
> +
> static inline void mips_syscall_update_nr(struct task_struct *task,
> struct pt_regs *regs)
> {
Otherwise:
Reviewed-by: Maciej W. Rozycki <macro at orcam.me.uk>
for this part, thank you!
Maciej
More information about the Strace-devel
mailing list