Audit system development
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Ricardo Robaina <rrobaina@redhat.com>,
	audit@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: eparis@redhat.com, Ricardo Robaina <rrobaina@redhat.com>
Subject: Re: [PATCH 2/2] audit: drop BUG_ON() from audit_signal_info_syscall()
Date: Tue, 28 Jul 2026 15:53:46 -0400	[thread overview]
Message-ID: <883ee05917e857f5176178f2f14f3cee@paul-moore.com> (raw)
In-Reply-To: <32c8fbc6f680e8309f64fd04f580b6a51bec0176.1785246707.git.rrobaina@redhat.com>

On Jul 28, 2026 Ricardo Robaina <rrobaina@redhat.com> wrote:
> 
> The BUG_ON(axp->pid_count >= AUDIT_AUX_PIDS) check in
> audit_signal_info_syscall() will panic the kernel if the signal target
> pid array overflows, which is too severe for this situation.
> 
> Replace it with a WARN_ON_ONCE() and return of -EINVAL, instead.
> 
> Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
> ---
>  kernel/auditsc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 6610e667c728..2b9ce0b52511 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -2712,7 +2712,8 @@ int audit_signal_info_syscall(struct task_struct *t)
>  		axp->d.next = ctx->aux_pids;
>  		ctx->aux_pids = (void *)axp;
>  	}
> -	BUG_ON(axp->pid_count >= AUDIT_AUX_PIDS);
> +	if (WARN_ON_ONCE(axp->pid_count >= AUDIT_AUX_PIDS))
> +		return -EINVAL;

Part of me wonders if the WARN_ON_ONCE() should be a pr_err(), possibly
ratelimited, but given that I don't recall ever seeing this BUG_ON()
trigger I think this is fine.  We can always change the WARN_ON_ONCE()
later if needed, getting rid of the BUG_ON() is the big win.

Merged into audit/dev, thanks.

>  	axp->target_pid[axp->pid_count] = task_tgid_nr(t);
>  	axp->target_auid[axp->pid_count] = audit_get_loginuid(t);
> -- 
> 2.53.0

--
paul-moore.com

  reply	other threads:[~2026-07-28 19:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 14:14 [PATCH 0/2] audit: drop BUG_ON() calls Ricardo Robaina
2026-07-28 14:14 ` [PATCH 1/2] audit: drop BUG_ON() from audit_add_to_parent() Ricardo Robaina
2026-07-28 19:53   ` Paul Moore
2026-07-28 22:45     ` Ricardo Robaina
2026-07-28 14:14 ` [PATCH 2/2] audit: drop BUG_ON() from audit_signal_info_syscall() Ricardo Robaina
2026-07-28 19:53   ` Paul Moore [this message]
2026-07-28 22:46     ` Ricardo Robaina

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=883ee05917e857f5176178f2f14f3cee@paul-moore.com \
    --to=paul@paul-moore.com \
    --cc=audit@vger.kernel.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rrobaina@redhat.com \
    /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