Audit system development
 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 v3 02/14] arm: pass pt_regs to audit_syscall_entry()
Date: Tue, 22 Sep 2026 19:39:14 +0000	[thread overview]
Message-ID: <20260922193914.8B2931F00893@smtp.kernel.org> (raw)
In-Reply-To: <619ddff49b82e8e494c96dc749c8c5114d6df07f.1790088067.git.rrobaina@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] arm/audit: audit bypass via ptrace syscall argument spoofing
--

commit 28f5bb87ea29cfbc21629b2a96c32dff55652268
Author: Ricardo Robaina <rrobaina@redhat.com>

arm: 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(). Drop the
individual argument registers from the call and pass regs instead.

> diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
> index ed7a2a87a6707..3c5d7fd733ec1 100644
> --- a/arch/arm/kernel/ptrace.c
> +++ b/arch/arm/kernel/ptrace.c
> @@ -868,8 +868,7 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
>  	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
>  		trace_sys_enter(regs, scno);
>  
> -	audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2,
> -			    regs->ARM_r3);
> +	audit_syscall_entry_regs(scno, regs);

[Severity: High]
Does this change introduce an audit bypass via ptrace syscall argument spoofing?

By switching to audit_syscall_entry_regs(), argument extraction is now
delegated to syscall_get_arguments(), which reads the first syscall argument
from regs->ARM_ORIG_r0:

arch/arm/include/asm/syscall.h:syscall_get_arguments() {
    ...
    args[0] = regs->ARM_ORIG_r0;
    ...
}

If a tracer intercepts execution using PTRACE_SYSCALL_ENTER and modifies
the first syscall argument via PTRACE_POKEUSER on ARM_r0, regs->ARM_r0 gets
updated but regs->ARM_ORIG_r0 remains unchanged.

Because of this change, audit will now log the original argument from
ARM_ORIG_r0. However, when execution resumes, the system call will execute
using the modified argument from ARM_r0. 

Could this allow a tracer to execute a modified payload while the audit
subsystem logs a different, benign one?

>  
>  	return scno;
>  }

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

  reply	other threads:[~2026-09-22 19:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 19:19 [PATCH v3 00/14] audit: log all six syscall arguments in the SYSCALL record Ricardo Robaina
2026-09-22 19:19 ` [PATCH v3 01/14] " Ricardo Robaina
2026-09-22 19:31   ` sashiko-bot
2026-09-23 11:29   ` Oleg Nesterov
2026-09-22 19:19 ` [PATCH v3 02/14] arm: pass pt_regs to audit_syscall_entry() Ricardo Robaina
2026-09-22 19:39   ` sashiko-bot [this message]
2026-10-01 21:47     ` Paul Moore
2026-09-22 19:19 ` [PATCH v3 03/14] arm64: " Ricardo Robaina
2026-09-22 19:31   ` sashiko-bot
2026-09-22 19:19 ` [PATCH v3 04/14] csky: " Ricardo Robaina
2026-09-22 19:32   ` sashiko-bot
2026-09-22 19:19 ` [PATCH v3 05/14] microblaze: " Ricardo Robaina
2026-09-22 19:30   ` sashiko-bot
2026-09-22 19:19 ` [PATCH v3 06/14] mips: " Ricardo Robaina
2026-09-22 19:33   ` sashiko-bot
2026-09-22 19:19 ` [PATCH v3 07/14] openrisc: " Ricardo Robaina
2026-09-22 19:33   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 08/14] parisc: mask compat syscall arguments in syscall_get_arguments() Ricardo Robaina
2026-09-22 19:33   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 09/14] parisc: pass pt_regs to audit_syscall_entry() Ricardo Robaina
2026-09-22 19:32   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 10/14] sh: " Ricardo Robaina
2026-09-22 19:33   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 11/14] sparc64: " Ricardo Robaina
2026-09-22 19:30   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 12/14] um: " Ricardo Robaina
2026-09-22 19:34   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 13/14] xtensa: " Ricardo Robaina
2026-09-22 19:36   ` sashiko-bot
2026-09-22 19:20 ` [PATCH v3 14/14] audit: rename audit_syscall_entry_regs() " Ricardo Robaina
2026-09-22 19:37   ` sashiko-bot
2026-09-23 11:30   ` Oleg Nesterov
2026-10-01 21:05 ` [PATCH v3 00/14] audit: log all six syscall arguments in the SYSCALL record Paul Moore

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=20260922193914.8B2931F00893@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