The Linux Kernel Mailing List
 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: Ricardo Robaina <rrobaina@redhat.com>, eparis@redhat.com, rgb@redhat.com
Subject: Re: [PATCH v2] audit: use task_tgid_nr() instead of task_pid_nr()
Date: Wed, 28 Aug 2024 16:48:26 -0400	[thread overview]
Message-ID: <49419bd051ccdb64de7222e2d17aa77d@paul-moore.com> (raw)
In-Reply-To: <20240828112528.954163-1-rrobaina@redhat.com>

On Aug 28, 2024 Ricardo Robaina <rrobaina@redhat.com> wrote:
> 
> In a few audit records, PIDs were being recorded with task_pid_nr()
> instead of task_tgid_nr().
> 
> $ grep "task_pid_nr" kernel/audit*.c
> audit.c:       task_pid_nr(current),
> auditfilter.c: pid = task_pid_nr(current);
> auditsc.c:     audit_log_format(ab, " pid=%u", task_pid_nr(current));
> 
> For single-thread applications, the process id (pid) and the thread
> group id (tgid) are the same. However, on multi-thread applications,
> task_pid_nr() returns the current thread id (user-space's TID), while
> task_tgid_nr() returns the main thread id (user-space's PID). Since
> the users are more interested in the process id (pid), rather than the
> thread id (tid), this patch converts these callers to the correct method.
> 
> Link: https://github.com/linux-audit/audit-kernel/issues/126
> 
> Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
> Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
> ---
> V1 -> V2: Added a more detailed commit description
> 
>  kernel/audit.c       | 2 +-
>  kernel/auditfilter.c | 2 +-
>  kernel/auditsc.c     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Looks good to me, merged into audit/dev, thanks!

--
paul-moore.com

      reply	other threads:[~2024-08-28 20:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 11:25 [PATCH v2] audit: use task_tgid_nr() instead of task_pid_nr() Ricardo Robaina
2024-08-28 20:48 ` Paul Moore [this message]

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=49419bd051ccdb64de7222e2d17aa77d@paul-moore.com \
    --to=paul@paul-moore.com \
    --cc=audit@vger.kernel.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgb@redhat.com \
    --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