Repository navigation
update-utmp: let libaudit determine comm on boot/shutdown - #43144
Conversation
Claude review of PR #43144 (1648602)The change is small and correct: the Nits
|
| #if HAVE_AUDIT | ||
| if (c->audit_fd >= 0) | ||
| if (sym_audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && | ||
| if (sym_audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", NULL, NULL, NULL, NULL, 1) < 0 && |
There was a problem hiding this comment.
Then, how about to use update-utmp or (update-utmp) ?
The automatic systemd-update-u is slightly ambiguous.
There was a problem hiding this comment.
I was considering naming it something like that, or shortening systemd to sd like done elsewhere, but wasn't sure about the conventions of when to parenthesize or when to prefix with sd- (or both). I went with "update-utmp" for now.
audit_log_user_comm_message from libaudit 4.2 rejects comm arguments that exceed the kernel's comm limit of 15 characters with EINVAL. The hard-coded "systemd-update-utmp" exceeds this by 4 characters. Shorten it to "update-utmp" instead. Signed-off-by: Markus Boehme <[email protected]>
bf189c5 to
1648602
Compare
| #if HAVE_AUDIT | ||
| if (c->audit_fd >= 0) | ||
| if (sym_audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && | ||
| if (sym_audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "update-utmp", NULL, NULL, NULL, 1) < 0 && |
There was a problem hiding this comment.
Claude: nit: Claude: The comm= value in the emitted AUDIT_SYSTEM_BOOT record changes from systemd-update-utmp to update-utmp. The new value is 11 chars, within the kernel's 15-char comm limit, accepted by both libaudit < 4.2 (no length check) and >= 4.2 (which rejected the old 19-char value with EINVAL), and it is printable ASCII so libaudit does not hex-encode it. The one downstream consequence worth flagging: any audit-log consumer matching on comm=systemd-update-utmp will no longer match. This is unavoidable given the fix and is intentional (it is also the value maintainer yuwata requested), but it is a visible record-semantics change on systems where the old value was previously accepted. The same applies to the AUDIT_SYSTEM_SHUTDOWN call at line 96.
yuwata
left a comment
There was a problem hiding this comment.
LGTM.
Next time, please drop 'Signed-off-by' tag from the commit message. We do not use it.
audit_log_user_comm_message from libaudit 4.2 rejects comm arguments that exceed the kernel's comm limit of 15 characters with EINVAL. The hard-coded "systemd-update-utmp" exceeds this by 4 characters.
Pass NULL as comm and let audit_log_user_comm_message determine comm using procfs instead. In practice, the AUDIT_SYSTEM_BOOT/SHUTDOWN audit records will have their comm set to "systemd-update-u".
Fixes: #43143