[PATCH 05/11] signal: Move audit_core_dumps from do_coredump into get_signal

From: Eric W. Biederman

Date: Fri Jun 26 2026 - 13:01:08 EST



The function audit_core_dumps is not about the coredumps but about
detecting the conditions that would trigger a coredump, and logging
something when that happens. The function audit_core_dumps runs
even if a coredump never happens.

So move audit_core_dumps out of do_coredump and into get_signal
to make it clear it does not care about the actual core dumps.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
fs/coredump.c | 2 --
kernel/signal.c | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 96801792a80e..14ec61c8d982 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1205,8 +1205,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
.cpu = raw_smp_processor_id(),
};

- audit_core_dumps(siginfo->si_signo);
-
if (coredump_skip(&cprm, binfmt))
return;

diff --git a/kernel/signal.c b/kernel/signal.c
index c211b520982f..986221bb0e0a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3034,6 +3034,7 @@ bool get_signal(struct ksignal *ksig)
if (print_fatal_signals)
print_fatal_signal(signr);
proc_coredump_connector(current);
+ audit_core_dumps(ksig->info.si_signo);
/*
* If it was able to dump core, this kills all
* other threads in the group and synchronizes with
--
2.41.0