All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit: free module name
@ 2022-06-15 15:44 ` Christian Göttsche
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Göttsche @ 2022-06-15 15:44 UTC (permalink / raw)
  Cc: Paul Moore, Eric Paris, Richard Guy Briggs, linux-audit, linux-kernel

Reset the type of the record last as the helper `audit_free_module()`
depends on it.

    unreferenced object 0xffff888153b707f0 (size 16):
      comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s)
      hex dump (first 16 bytes):
        62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5  binfmt_misc.kkk.
      backtrace:
        [<ffffffffa07dbf9b>] kstrdup+0x2b/0x50
        [<ffffffffa04b0a9d>] __audit_log_kern_module+0x4d/0xf0
        [<ffffffffa03b6664>] load_module+0x9d4/0x2e10
        [<ffffffffa03b8f44>] __do_sys_finit_module+0x114/0x1b0
        [<ffffffffa1f47124>] do_syscall_64+0x34/0x80
        [<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 kernel/auditsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index f3a2abd6d1a1..3a8c9d744800 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1014,10 +1014,10 @@ static void audit_reset_context(struct audit_context *ctx)
 	ctx->target_comm[0] = '\0';
 	unroll_tree_refs(ctx, NULL, 0);
 	WARN_ON(!list_empty(&ctx->killed_trees));
-	ctx->type = 0;
 	audit_free_module(ctx);
 	ctx->fds[0] = -1;
 	audit_proctitle_free(ctx);
+	ctx->type = 0; /* reset last for audit_free_*() */
 }
 
 static inline struct audit_context *audit_alloc_context(enum audit_state state)
-- 
2.36.1


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

* [PATCH] audit: free module name
@ 2022-06-15 15:44 ` Christian Göttsche
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Göttsche @ 2022-06-15 15:44 UTC (permalink / raw)
  Cc: Richard Guy Briggs, linux-audit, Eric Paris, linux-kernel

Reset the type of the record last as the helper `audit_free_module()`
depends on it.

    unreferenced object 0xffff888153b707f0 (size 16):
      comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s)
      hex dump (first 16 bytes):
        62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5  binfmt_misc.kkk.
      backtrace:
        [<ffffffffa07dbf9b>] kstrdup+0x2b/0x50
        [<ffffffffa04b0a9d>] __audit_log_kern_module+0x4d/0xf0
        [<ffffffffa03b6664>] load_module+0x9d4/0x2e10
        [<ffffffffa03b8f44>] __do_sys_finit_module+0x114/0x1b0
        [<ffffffffa1f47124>] do_syscall_64+0x34/0x80
        [<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 kernel/auditsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index f3a2abd6d1a1..3a8c9d744800 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1014,10 +1014,10 @@ static void audit_reset_context(struct audit_context *ctx)
 	ctx->target_comm[0] = '\0';
 	unroll_tree_refs(ctx, NULL, 0);
 	WARN_ON(!list_empty(&ctx->killed_trees));
-	ctx->type = 0;
 	audit_free_module(ctx);
 	ctx->fds[0] = -1;
 	audit_proctitle_free(ctx);
+	ctx->type = 0; /* reset last for audit_free_*() */
 }
 
 static inline struct audit_context *audit_alloc_context(enum audit_state state)
-- 
2.36.1

--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit

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

* Re: [PATCH] audit: free module name
  2022-06-15 15:44 ` Christian Göttsche
@ 2022-06-15 23:33   ` Paul Moore
  -1 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2022-06-15 23:33 UTC (permalink / raw)
  To: Christian Göttsche
  Cc: Eric Paris, Richard Guy Briggs, linux-audit, linux-kernel

On Wed, Jun 15, 2022 at 11:44 AM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Reset the type of the record last as the helper `audit_free_module()`
> depends on it.
>
>     unreferenced object 0xffff888153b707f0 (size 16):
>       comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s)
>       hex dump (first 16 bytes):
>         62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5  binfmt_misc.kkk.
>       backtrace:
>         [<ffffffffa07dbf9b>] kstrdup+0x2b/0x50
>         [<ffffffffa04b0a9d>] __audit_log_kern_module+0x4d/0xf0
>         [<ffffffffa03b6664>] load_module+0x9d4/0x2e10
>         [<ffffffffa03b8f44>] __do_sys_finit_module+0x114/0x1b0
>         [<ffffffffa1f47124>] do_syscall_64+0x34/0x80
>         [<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
>
> Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
>  kernel/auditsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks Christian, I just merged this into audit/stable-5.19 and I'll
send this up to Linus as soon as the automated tests finish their
runs.

-- 
paul-moore.com

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

* Re: [PATCH] audit: free module name
@ 2022-06-15 23:33   ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2022-06-15 23:33 UTC (permalink / raw)
  To: Christian Göttsche
  Cc: Richard Guy Briggs, linux-audit, linux-kernel, Eric Paris

On Wed, Jun 15, 2022 at 11:44 AM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> Reset the type of the record last as the helper `audit_free_module()`
> depends on it.
>
>     unreferenced object 0xffff888153b707f0 (size 16):
>       comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s)
>       hex dump (first 16 bytes):
>         62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5  binfmt_misc.kkk.
>       backtrace:
>         [<ffffffffa07dbf9b>] kstrdup+0x2b/0x50
>         [<ffffffffa04b0a9d>] __audit_log_kern_module+0x4d/0xf0
>         [<ffffffffa03b6664>] load_module+0x9d4/0x2e10
>         [<ffffffffa03b8f44>] __do_sys_finit_module+0x114/0x1b0
>         [<ffffffffa1f47124>] do_syscall_64+0x34/0x80
>         [<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
>
> Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls")
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
>  kernel/auditsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks Christian, I just merged this into audit/stable-5.19 and I'll
send this up to Linus as soon as the automated tests finish their
runs.

-- 
paul-moore.com

--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit

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

end of thread, other threads:[~2022-06-15 23:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 15:44 [PATCH] audit: free module name Christian Göttsche
2022-06-15 15:44 ` Christian Göttsche
2022-06-15 23:33 ` Paul Moore
2022-06-15 23:33   ` Paul Moore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.