Commit 7e4081c
committed
audit: use task_tgid_nr() instead of task_pid_nr()
JIRA: https://issues.redhat.com/browse/RHEL-78967
This patch is a backport of the following upstream commit:
commit 61c6097
Author: Ricardo Robaina <rrobaina@redhat.com>
Date: Wed Aug 28 08:25:06 2024 -0300
audit: use task_tgid_nr() instead of task_pid_nr()
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: linux-audit/audit-kernel#126
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>1 parent 06792db commit 7e4081c
3 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1612 | 1612 | | |
1613 | 1613 | | |
1614 | 1614 | | |
1615 | | - | |
| 1615 | + | |
1616 | 1616 | | |
1617 | 1617 | | |
1618 | 1618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1343 | 1343 | | |
1344 | 1344 | | |
1345 | 1345 | | |
1346 | | - | |
| 1346 | + | |
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2937 | 2937 | | |
2938 | 2938 | | |
2939 | 2939 | | |
2940 | | - | |
| 2940 | + | |
2941 | 2941 | | |
2942 | 2942 | | |
2943 | 2943 | | |
| |||
0 commit comments