Skip to content

Commit dc644fb

Browse files
committed
Merge tag 'audit-pr-20240911' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit
Pull audit updates from Paul Moore: - Fix some remaining problems with PID/TGID reporting When most users think about PIDs, what they are really thinking about is the TGID. This commit shifts the audit PID logging and filtering to use the TGID value which should provide a more meaningful audit stream and filtering experience for users. - Migrate to the str_enabled_disabled() helper Evidently we have helper functions that help ensure if we mistype "enabled" or "disabled" it is now caught at compile time. I guess we're fancy now. * tag 'audit-pr-20240911' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit: Make use of str_enabled_disabled() helper audit: use task_tgid_nr() instead of task_pid_nr()
2 parents 43a64bd + 8c1867a commit dc644fb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

kernel/audit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ static void audit_log_multicast(int group, const char *op, int err)
16121612
cred = current_cred();
16131613
tty = audit_get_tty();
16141614
audit_log_format(ab, "pid=%u uid=%u auid=%u tty=%s ses=%u",
1615-
task_pid_nr(current),
1615+
task_tgid_nr(current),
16161616
from_kuid(&init_user_ns, cred->uid),
16171617
from_kuid(&init_user_ns, audit_get_loginuid(current)),
16181618
tty ? tty_name(tty) : "(none)",
@@ -1706,7 +1706,7 @@ static int __init audit_init(void)
17061706
audit_cmd_mutex.owner = NULL;
17071707

17081708
pr_info("initializing netlink subsys (%s)\n",
1709-
audit_default ? "enabled" : "disabled");
1709+
str_enabled_disabled(audit_default));
17101710
register_pernet_subsys(&audit_net_ops);
17111711

17121712
audit_initialized = AUDIT_INITIALIZED;

kernel/auditfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ int audit_filter(int msgtype, unsigned int listtype)
13441344

13451345
switch (f->type) {
13461346
case AUDIT_PID:
1347-
pid = task_pid_nr(current);
1347+
pid = task_tgid_nr(current);
13481348
result = audit_comparator(pid, f->op, f->val);
13491349
break;
13501350
case AUDIT_UID:

kernel/auditsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2933,7 +2933,7 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
29332933
audit_log_format(ab, "table=%s family=%u entries=%u op=%s",
29342934
name, af, nentries, audit_nfcfgs[op].s);
29352935

2936-
audit_log_format(ab, " pid=%u", task_pid_nr(current));
2936+
audit_log_format(ab, " pid=%u", task_tgid_nr(current));
29372937
audit_log_task_context(ab); /* subj= */
29382938
audit_log_format(ab, " comm=");
29392939
audit_log_untrustedstring(ab, get_task_comm(comm, current));

0 commit comments

Comments
 (0)