Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm
@ 2026-08-18 18:28 Richard Guy Briggs
  2026-08-18 18:31 ` Richard Guy Briggs
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard Guy Briggs @ 2026-08-18 18:28 UTC (permalink / raw)
  To: Linux-Audit Mailing List, LKML, linux-fsdevel,
	Linux Kernel Audit Mailing List
  Cc: Paul Moore, Eric Paris, Steve Grubb, Richard Guy Briggs,
	Roman Dolgikh, Ricardo Robaina

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.

Suggested-by: Roman Dolgikh <rmd4work@mail.ru>
Link: https://github.com/user-attachments/files/20751461/fix_audit_proctitle.txt
Link: https://github.com/linux-audit/audit-kernel/issues/170
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
---
 kernel/auditsc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 2b9ce0b52511..ee7e53d2cd52 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -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;
 }
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm
  2026-08-18 18:28 [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm Richard Guy Briggs
@ 2026-08-18 18:31 ` Richard Guy Briggs
  2026-08-20 20:52 ` Bradley Morgan
  2026-08-24 22:07 ` Paul Moore
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Guy Briggs @ 2026-08-18 18:31 UTC (permalink / raw)
  To: Linux-Audit Mailing List, LKML, linux-fsdevel,
	Linux Kernel Audit Mailing List
  Cc: Paul Moore, Eric Paris, Steve Grubb, Richard Guy Briggs,
	Roman Dolgikh, Ricardo Robaina

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.

Suggested-by: Roman Dolgikh <rmd4work@mail.ru>
Link: https://github.com/user-attachments/files/20751461/fix_audit_proctitle.txt
Link: https://github.com/linux-audit/audit-kernel/issues/170
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
---
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(+)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 2b9ce0b52511..ee7e53d2cd52 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -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;
 }
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm
  2026-08-18 18:28 [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm Richard Guy Briggs
  2026-08-18 18:31 ` Richard Guy Briggs
@ 2026-08-20 20:52 ` Bradley Morgan
  2026-08-24 22:07 ` Paul Moore
  2 siblings, 0 replies; 4+ messages in thread
From: Bradley Morgan @ 2026-08-20 20:52 UTC (permalink / raw)
  To: rgb
  Cc: audit, eparis, linux-audit, linux-fsdevel, linux-kernel, paul,
	rmd4work, rrobaina, sgrubb

On 18 August 2026 19:28:53 BST, Richard Guy Briggs <rgb@redhat.com> 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.
>
>Suggested-by: Roman Dolgikh <rmd4work@mail.ru>
>Link: https://github.com/user-attachments/files/20751461/fix_audit_proctitle.txt
>Link: https://github.com/linux-audit/audit-kernel/issues/170
>Signed-off-by: Richard Guy Briggs <rgb@redhat.com>

LGTM, cheers

Reviewed-by: Bradley Morgan <include@grrlz.net>



>Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
>---
> kernel/auditsc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/kernel/auditsc.c b/kernel/auditsc.c
>index 2b9ce0b52511..ee7e53d2cd52 100644
>--- a/kernel/auditsc.c
>+++ b/kernel/auditsc.c
>@@ -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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] audit: free proctitle in context so it can be re-set by  fork on exec_binprm
  2026-08-18 18:28 [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm Richard Guy Briggs
  2026-08-18 18:31 ` Richard Guy Briggs
  2026-08-20 20:52 ` Bradley Morgan
@ 2026-08-24 22:07 ` Paul Moore
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2026-08-24 22:07 UTC (permalink / raw)
  To: Richard Guy Briggs, Linux-Audit Mailing List, LKML, linux-fsdevel,
	Linux Kernel Audit Mailing List
  Cc: Eric Paris, Steve Grubb, Richard Guy Briggs, Roman Dolgikh,
	Ricardo Robaina

On Aug 18, 2026 Richard Guy Briggs <rgb@redhat.com> 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.
> 
> Suggested-by: Roman Dolgikh <rmd4work@mail.ru>
> Link: https://github.com/user-attachments/files/20751461/fix_audit_proctitle.txt

I did drop the link above from the commit as it is contained within the
link below.

> Link: https://github.com/linux-audit/audit-kernel/issues/170
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
> Reviewed-by: Bradley Morgan <include@grrlz.net>
> ---
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-24 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 18:28 [PATCH v3] audit: free proctitle in context so it can be re-set by fork on exec_binprm Richard Guy Briggs
2026-08-18 18:31 ` Richard Guy Briggs
2026-08-20 20:52 ` Bradley Morgan
2026-08-24 22:07 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox