From: Richard Guy Briggs <rgb@redhat.com>
To: Linux-Audit Mailing List <linux-audit@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Cc: Paul Moore <paul@paul-moore.com>,
Eric Paris <eparis@parisplace.org>,
Steve Grubb <sgrubb@redhat.com>,
Richard Guy Briggs <rgb@redhat.com>,
omosnace@redhat.com
Subject: [PATCH ghak138 v2 3/4] audit: free audit_proctitle only on task exit
Date: Thu, 25 Aug 2022 15:32:39 -0400 [thread overview]
Message-ID: <c925257a4e99a76f8a8efef014a58ca7af40d537.1661449312.git.rgb@redhat.com> (raw)
In-Reply-To: <cover.1661449312.git.rgb@redhat.com>
Since audit_proctitle is generated at syscall exit time, its value is
used immediately and cached for the next syscall. Since this is the
case, then only clear it at task exit time. Otherwise, there is no
point in caching the value OR bearing the overhead of regenerating it.
Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
---
kernel/auditsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index d77c9805c6b1..280b4720c7a0 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1016,7 +1016,6 @@ static void audit_reset_context(struct audit_context *ctx)
WARN_ON(!list_empty(&ctx->killed_trees));
audit_free_module(ctx);
ctx->fds[0] = -1;
- audit_proctitle_free(ctx);
ctx->type = 0; /* reset last for audit_free_*() */
}
@@ -1077,6 +1076,7 @@ static inline void audit_free_context(struct audit_context *context)
{
/* resetting is extra work, but it is likely just noise */
audit_reset_context(context);
+ audit_proctitle_free(context);
free_tree_refs(context);
kfree(context->filterkey);
kfree(context);
--
2.27.0
next prev parent reply other threads:[~2022-08-25 19:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 19:32 [PATCH ghak138 v2 0/4] issues from moving beyond syscalls Richard Guy Briggs
2022-08-25 19:32 ` [PATCH ghak138 v2 1/4] audit: audit_context pid unused, context enum comment fix Richard Guy Briggs
2022-08-26 21:16 ` Paul Moore
2022-08-25 19:32 ` [PATCH ghak138 v2 2/4] audit: explicitly check audit_context->context enum value Richard Guy Briggs
2022-08-26 21:18 ` Paul Moore
2022-08-25 19:32 ` Richard Guy Briggs [this message]
2022-08-26 21:20 ` [PATCH ghak138 v2 3/4] audit: free audit_proctitle only on task exit Paul Moore
2022-08-25 19:32 ` [PATCH ghak138 v2 4/4] audit: move audit_return_fixup before the filters Richard Guy Briggs
2022-08-25 21:36 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c925257a4e99a76f8a8efef014a58ca7af40d537.1661449312.git.rgb@redhat.com \
--to=rgb@redhat.com \
--cc=eparis@parisplace.org \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=sgrubb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®