All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ricardo Robaina" <rrobaina@redhat.com>
Cc: audit@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v2 08/13] openrisc: pass pt_regs to audit_syscall_entry()
Date: Wed, 02 Sep 2026 15:07:24 +0000	[thread overview]
Message-ID: <20260902150725.70ECD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20dc1432035e116c2a0be75afc0504e4a8ac4274.1788351089.git.rrobaina@redhat.com>

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

Pre-existing issues:
- [High] Syscall abortion via ptrace is ignored by the assembly fastpath, causing aborted syscalls to execute anyway.
- [High] Tracer-directed syscall number mutations are ignored by both the audit subsystem and the execution path.
--

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

openrisc: 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/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
> index 287a9718f0c60..eca613b84ff87 100644
> --- a/arch/openrisc/kernel/ptrace.c
> +++ b/arch/openrisc/kernel/ptrace.c
> @@ -301,8 +301,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
>  		 */
>  		ret = -1L;
>  
> -	audit_syscall_entry(regs->gpr[11], regs->gpr[3], regs->gpr[4],
> -			    regs->gpr[5], regs->gpr[6]);
> +	audit_syscall_entry(regs->gpr[11], regs);

[Severity: High]
This is a pre-existing issue, but does hardcoding regs->gpr[11] here ignore
tracer-directed syscall number mutations?

The generic framework's syscall_set_nr() updates regs->orig_gpr11 with the new
syscall number. However, this code directly passes regs->gpr[11] to
audit_syscall_entry() instead of using syscall_get_nr(current, regs).

Additionally, the _syscall_call assembly fastpath appears to use the original
syscall number reloaded from PT_GPR11(r1). Since neither layer reads
orig_gpr11, standard PTRACE_SET_SYSCALL_INFO mutations seem to silently fail
to influence the kernel on OpenRISC.

>  
>  	return ret ? : regs->gpr[11];

[Severity: High]
This is also a pre-existing issue, but does this function successfully abort
syscalls when a tracer denies them?

When a tracer denies a syscall, ptrace_report_syscall_permit_entry() causes
ret to be set to -1L, which is then returned. However, looking at the
assembly fastpath in arch/openrisc/kernel/entry.S:_syscall_trace_enter:

	l.jal	do_syscall_trace_enter
	 l.addi	r3,r1,0

	/* Restore arguments ... */
	l.lwz	r11,PT_GPR11(r1)

Doesn't this instruction blindly reload the original unmodified syscall number
from the stack into r11?

Since do_syscall_trace_enter() never writes -1L back to regs->gpr[11] in
memory, it seems the abort signal is permanently lost when the assembly
restores registers, allowing the aborted syscall to execute anyway.

>  }

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

  reply	other threads:[~2026-09-02 15:07 UTC|newest]

Thread overview: 30+ 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-04 17:21   ` Magnus Lindholm
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 [this message]
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
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=20260902150725.70ECD1F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.