diff options
author | Harald Brinkmann <brinkmannh@mx-vk.eu> | 2023-11-28 13:48:59 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-02 01:43:50 +0100 |
commit | 2a9b1a76ee730096188fc62f4b26409d47a9def2 (patch) | |
tree | 00057f15e81cc67a968f379a718b0650b1cf04c8 /src/coredump | |
parent | Merge pull request #31166 from mrc0mmand/vpick-tweaks (diff) | |
download | systemd-2a9b1a76ee730096188fc62f4b26409d47a9def2.tar.xz systemd-2a9b1a76ee730096188fc62f4b26409d47a9def2.zip |
coredump: log minimal metadata early
Diffstat (limited to 'src/coredump')
-rw-r--r-- | src/coredump/coredump.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index cd5e5343f0..51218fc4c8 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -1558,7 +1558,7 @@ static int forward_coredump_to_container(Context *context) { static int process_kernel(int argc, char* argv[]) { _cleanup_(iovw_free_freep) struct iovec_wrapper *iovw = NULL; Context context = {}; - int r; + int r, signo; /* When we're invoked by the kernel, stdout/stderr are closed which is dangerous because the fds * could get reallocated. To avoid hard to debug issues, let's instead bind stdout/stderr to @@ -1587,6 +1587,12 @@ static int process_kernel(int argc, char* argv[]) { /* OK, now we know it's not the journal, hence we can make use of it now. */ log_set_target_and_open(LOG_TARGET_JOURNAL_OR_KMSG); + /* Log minimal metadata now, so it is not lost if the system is about to shut down. */ + log_info("Process %s (%s) of user %s terminated abnormally with signal %s/%s, processing...", + context.meta[META_ARGV_PID], context.meta[META_COMM], + context.meta[META_ARGV_UID], context.meta[META_ARGV_SIGNAL], + strna(safe_atoi(context.meta[META_ARGV_SIGNAL], &signo) >= 0 ? signal_to_string(signo) : NULL)); + r = in_same_namespace(getpid_cached(), context.pid, NAMESPACE_PID); if (r < 0) log_debug_errno(r, "Failed to check pidns of crashing process, ignoring: %m"); |