return 0;
}
+static void coredump_context_check_pidns(CoredumpContext *context) {
+ int r;
+
+ assert(context);
+ assert(pidref_is_set(&context->pidref));
+
+ r = pidref_in_same_namespace(/* pid1 = */ NULL, &context->pidref, NAMESPACE_PID);
+ if (r < 0)
+ log_debug_errno(r, "Failed to check pidns of crashing process, ignoring: %m");
+
+ context->same_pidns = r != 0;
+}
+
static int coredump_context_parse_from_procfs(CoredumpContext *context) {
int r;
"Mandatory argument %s not received on socket.",
metadata_field_to_string(i));
+ coredump_context_check_pidns(context);
return 0;
}
return r;
}
+ coredump_context_check_pidns(context);
return coredump_context_parse_from_procfs(context);
}
char *auxv; /* META_PROC_AUXV */
size_t auxv_size; /* META_PROC_AUXV */
bool got_pidfd; /* META_ARGV_PIDFD */
+ bool same_pidns;
bool forwarded;
int input_fd;
int mount_tree_fd;
#include "format-util.h"
#include "iovec-wrapper.h"
#include "log.h"
-#include "namespace-util.h"
#include "signal-util.h"
int coredump_kernel_helper(int argc, char *argv[]) {
context.pidref.pid, context.comm, context.uid, context.signo,
signal_to_string(context.signo));
- r = pidref_in_same_namespace(/* pid1 = */ NULL, &context.pidref, NAMESPACE_PID);
- if (r < 0)
- log_debug_errno(r, "Failed to check pidns of crashing process, ignoring: %m");
- if (r == 0) {
+ if (!context.same_pidns) {
/* If this fails, fallback to the old behavior so that
* there is still some record of the crash. */
r = coredump_send_to_container(&context);