From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFE583E1D1D for ; Thu, 13 Aug 2026 17:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643888; cv=none; b=QKt2EmqMXCYnHp6TXXfYhQOgWbBgz1Pjw7iMdEuXNJte58MZuCDKXaqCuuGassKKENx9XRlvz0xjot/0kVT/OYD5Jm4PQ8Ss0JnhcR6fRsjNP3oDFm161SPciAQ25xdLgWEDTwaQqavGHnLPXU3xe1MdQYFwFA469FiOicv8zcc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786643888; c=relaxed/simple; bh=TyKtUql8/UMqDIvuNXPwCFvRWEM9LL83DrHVkXw9tQk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=i8bi5L44t7fzObHukC4H8JmSMBTQey7pjoyNEZLMZ8JkkAwTaEmX3dAPtGCwemtDzyfXeNpS9Avc21f1JCxpofEnTRDu1QJIg40rApnCYzusmIY3TxueGu0Bk/ScLQ1hgPVIGLmKuKxd9UXSPodeWyQ1cg8gXM5Jxi50IzDPKfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QVGSep/D; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QVGSep/D" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786643876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OukkhkVorBxthESNUlOuVMe4JLx+OvknbdAjxQDfoCo=; b=QVGSep/DCWKtAO/DqHeHCmaqh4aWg1GTyftKx6yRDuiDgvIzdshOoSXM2xACH1UIe4w9KO IuJSt/ZV5XmyH+r4lPRKx2d176cqwG6qqlZ9l2PX0Clz28O+0nzJU7H5yefEkHrawnG4jW FHVbi7luNszyZWvgh7xpjrKstvnA58A= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-LcEgHWJwMwyEu-ZNJlzpMQ-1; Thu, 13 Aug 2026 13:57:43 -0400 X-MC-Unique: LcEgHWJwMwyEu-ZNJlzpMQ-1 X-Mimecast-MFC-AGG-ID: LcEgHWJwMwyEu-ZNJlzpMQ_1786643862 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8372E195609D; Thu, 13 Aug 2026 17:57:41 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.22.74.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C939180049F; Thu, 13 Aug 2026 17:57:38 +0000 (UTC) Date: Thu, 13 Aug 2026 13:57:36 -0400 From: Richard Guy Briggs To: Ricardo Robaina Cc: Linux-Audit Mailing List , LKML , linux-fsdevel@vger.kernel.org, Linux Kernel Audit Mailing List , Paul Moore , Eric Paris , Steve Grubb , Roman Dolgikh Subject: Re: [PATCH v2] audit: free proctitle in context so it can be re-set by fork on exec_binprm Message-ID: References: Precedence: bulk X-Mailing-List: audit@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-MFC-PROC-ID: VWfpCSkBlFYZT4oduzG53mOc77KaV_zTj37qHOtd0K8_1786643862 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2026-08-07 09:25, Ricardo Robaina wrote: > On Thu, Aug 6, 2026 at 6:17 PM Richard Guy Briggs 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 > > 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 > > --- > > Changelog: > > 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 6610e667c728..c12b5dfcb279 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(audit_context()); > > Since we already got the context right above, it would probably be > better to use the context var instead to avoid calling audit_context() > again. Yup, right you are. Silly oversight. > Otherwise looks good to me. > > Reviewed-by: Ricardo Robaina > > > context->type = AUDIT_EXECVE; > > context->execve.argc = bprm->argc; > > } > > -- > > 2.43.5 > > -Ricardo - RGB -- Richard Guy Briggs 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