Skip to contentSkip to conversation

audit: free proctitle in context so it can be re-set by fork on exec_binprm

PATCH Applied Richard Guy Briggs 4 participants 6 messages Aug 18 – Aug 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 2b9ce0b52511..ee7e53d2cd52 100644
@@ -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
#1 lore raw
Sashiko 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
Reviewed-by on v3 1/1
#2 lore raw
In reply to Richard Guy Briggs
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

---
kernel/auditsc.c | 2 ++

1 file changed, 2 insertions(+)
kernel/auditsc.c +0 -0
index 2b9ce0b52511..ee7e53d2cd52 100644

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!

maintainer Applied
#3 lore raw
In reply to Richard Guy Briggs
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

---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need in audit_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

#4 lore raw
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

---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need in audit_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

maintainer
#5 lore raw
In reply to Paul Moore
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

---
Changelog:
v3: use previously assigned context
v2: simplified to call single use directly before need in audit_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