BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ricardo Robaina" <rrobaina@redhat.com>
Cc: bpf@vger.kernel.org, audit@vger.kernel.org
Subject: Re: [PATCH v2 10/13] sh: pass pt_regs to audit_syscall_entry()
Date: Wed, 02 Sep 2026 14:58:01 +0000	[thread overview]
Message-ID: <20260902145801.AE8E51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <097bd384731da18be54fafd41f67c60e2a70e37e.1788351089.git.rrobaina@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Syscall spoofing vulnerability: trace_sys_enter() logs the user-controlled 5th argument instead of the true syscall ID.
--

commit 54980eef37cc5d7ecba9111c6a7139474010c424
Author: Ricardo Robaina <rrobaina@redhat.com>

sh: pass pt_regs to audit_syscall_entry()

audit_syscall_entry() now takes a pointer to pt_regs and extracts the syscall
arguments itself via syscall_get_arguments(). This commit drops the individual
argument registers from the call and passes regs instead.

> diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
> index 8794081483fbd..e138f529ee7ec 100644
> --- a/arch/sh/kernel/ptrace_32.c
> +++ b/arch/sh/kernel/ptrace_32.c
> @@ -466,8 +466,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
>  	if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
>  		trace_sys_enter(regs, regs->regs[0]);

[Severity: Critical]
This isn't a bug introduced by this patch, but it appears there is a
critical pre-existing issue here in do_syscall_trace_enter().

Could trace_sys_enter() be logging the wrong syscall ID?

On SH32, the actual syscall number is in regs->regs[3], while regs->regs[0]
contains the 5th argument, which is a user-controlled value.

Because do_syscall_trace_enter() passes regs->regs[0] to trace_sys_enter(), a
user-space application might be able to invoke a malicious syscall (like
execve) while populating the 5th argument register with a benign syscall ID.

Does this mismatch allow attackers to execute one syscall while security
monitors log another, potentially bypassing eBPF and ftrace monitors?

> -	audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5],
> -			    regs->regs[6], regs->regs[7]);
> +	audit_syscall_entry(regs->regs[3], regs);
>  
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788351089.git.rrobaina@redhat.com?part=10

  reply	other threads:[~2026-09-02 14:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 14:43 [PATCH v2 00/13] audit: log all six syscall arguments in the SYSCALL record Ricardo Robaina
2026-09-02 14:43 ` [PATCH v2 01/13] " Ricardo Robaina
2026-09-02 14:55   ` sashiko-bot
2026-09-03  8:21   ` Will Deacon
2026-09-02 14:43 ` [PATCH v2 02/13] alpha: pass pt_regs to audit_syscall_entry() Ricardo Robaina
2026-09-02 14:55   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 03/13] arm: " Ricardo Robaina
2026-09-02 14:58   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 04/13] arm64: " Ricardo Robaina
2026-09-02 15:04   ` sashiko-bot
2026-09-03  8:22   ` Will Deacon
2026-09-02 14:43 ` [PATCH v2 05/13] csky: " Ricardo Robaina
2026-09-02 14:58   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 06/13] microblaze: " Ricardo Robaina
2026-09-02 14:56   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 07/13] mips: " Ricardo Robaina
2026-09-02 14:57   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 08/13] openrisc: " Ricardo Robaina
2026-09-02 15:07   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 09/13] parisc: " Ricardo Robaina
2026-09-02 15:01   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 10/13] sh: " Ricardo Robaina
2026-09-02 14:58   ` sashiko-bot [this message]
2026-09-02 14:43 ` [PATCH v2 11/13] sparc64: " Ricardo Robaina
2026-09-02 15:01   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 12/13] um: " Ricardo Robaina
2026-09-02 15:07   ` sashiko-bot
2026-09-02 14:43 ` [PATCH v2 13/13] xtensa: " Ricardo Robaina
2026-09-02 15:02   ` sashiko-bot

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=20260902145801.AE8E51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=audit@vger.kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rrobaina@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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