audit: free proctitle in context so it can be re-set by fork on exec_binprm
PATCH v3 1/1 audit: free proctitle in context so it can be re-set by fork on exec_binprm
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
--- kernel/auditsc.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/auditsc.c +2 -0
@@ -2601,6 +2601,8 @@ void __audit_bprm(struct linux_binprm *bprm) {struct audit_context *context =audit_context (); +/* clear proctitle in audit context to allow replacement */ +audit_proctitle_free (context); context->type =AUDIT_EXECVE ; context->execve.argc = bprm->argc; }
Signature · 1 line
2.43.5
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
Quoted 4 lines
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/ef5bf18a4b3805ec0fe5fb638963ccbdfc01d6fe.1787077711.git.rgb@redhat.com?part=1
Quoted 8 lines · Richard Guy Briggs
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
Quoted 4 lines
LGTM, cheers
Quoted 11 lines
Reviewed-by Ricardo Robaina <[email protected]>---
kernel/auditsc.c| 2 ++1 file changed, 2 insertions(+)kernel/auditsc.c +0
-0
kernel/auditsc.c void __audit_bprm(struct linux_binprm *bprm) · line 2608
Quoted 8 lines
kernel/auditsc.c +2
-0@@ -2601,6 +2601,8 @@ void __audit_bprm(struct linux_binprm *bprm) {struct audit_context *context =audit_context (); +/* clear proctitle in audit context to allow replacement */ +audit_proctitle_free (context); context->type =AUDIT_EXECVE ; context->execve.argc = bprm->argc; }
Thanks!
Quoted 11 lines · On Aug 18, 2026 Richard Guy Briggs <[email protected]> wrote:
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
I did drop the link above from the commit as it is contained within the link below.
Quoted 11 lines
Signed-off-by Richard Guy Briggs <[email protected]>Reviewed-by Ricardo Robaina <[email protected]>Reviewed-by Bradley Morgan <[email protected]>---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need inaudit_bimprm--- kernel/auditsc.c | 2 ++ 1 file changed, 2 insertions(+)
Merged into audit/dev-staging since we're currently in the middle of the merge window, this will got to audit/dev once the window closes.
--
paul-moore.com
Quoted 28 lines · Paul Moore
Quoted 11 lines · On Aug 18, 2026 Richard Guy Briggs <[email protected]> wrote:
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
I did drop the link above from the commit as it is contained within the link below.
Quoted 11 lines
Signed-off-by Richard Guy Briggs <[email protected]>Reviewed-by Ricardo Robaina <[email protected]>Reviewed-by Bradley Morgan <[email protected]>---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need inaudit_bimprm--- kernel/auditsc.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 2 lines
Merged into audit/dev-staging since we're currently in the middle of the merge window, this will got to audit/dev once the window closes.
Thank you!
Quoted 1 line
paul-moore.com
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
Upstream IRC: SunRaycer
Voice: +1.613.860 2354 SMS: +1.613.518.6570
Paul Moore
maintainerQuoted 28 lines · Paul Moore
Quoted 11 lines · On Aug 18, 2026 Richard Guy Briggs <[email protected]> wrote:
Between the actual process startup (fork systemd) and the executable file replacement (exec), systemd sets a temporary file name (executable file name in parentheses). If an auditable system call occurs at this point, the audit context will latch the temporary process name into the cache. This name will not change again. The patch clears proctitle into the audit cache when the exec call is made, allowing the new process name to be latched.
I did drop the link above from the commit as it is contained within the link below.
Quoted 11 lines
Signed-off-by Richard Guy Briggs <[email protected]>Reviewed-by Ricardo Robaina <[email protected]>Reviewed-by Bradley Morgan <[email protected]>---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need inaudit_bimprm--- kernel/auditsc.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 2 lines
Merged into audit/dev-staging since we're currently in the middle of the merge window, this will got to audit/dev once the window closes.
... and now it's in audit/dev, thanks!
Signature · 1 line
paul-moore.com