diff options
author | Jakub Filak <jfilak@redhat.com> | 2016-04-26 09:54:39 +0200 |
---|---|---|
committer | Jakub Filak <jfilak@redhat.com> | 2016-08-02 10:00:46 +0200 |
commit | d7032b1fcd6e51b736698a8b264273c625084643 (patch) | |
tree | 6f58123b2f482db8b0b595b5c7af741ad97d2479 | |
parent | a912ab0474e2fcdc346d0315a8493f0f3ac867aa (diff) |
coredump: save /proc/[pid]/mountinfo
The file contains information one can use to debug processes running
within a container.
-rw-r--r-- | src/coredump/coredump.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index dcc09fcc6d..953f04e205 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -933,11 +933,12 @@ static int process_kernel(int argc, char* argv[]) { /* The larger ones we allocate on the heap */ _cleanup_free_ char *core_owner_uid = NULL, *core_open_fds = NULL, *core_proc_status = NULL, - *core_proc_maps = NULL, *core_proc_limits = NULL, *core_proc_cgroup = NULL, *core_environ = NULL; + *core_proc_maps = NULL, *core_proc_limits = NULL, *core_proc_cgroup = NULL, *core_environ = NULL, + *core_proc_mountinfo = NULL; _cleanup_free_ char *exe = NULL, *comm = NULL; const char *context[_CONTEXT_MAX]; - struct iovec iovec[25]; + struct iovec iovec[26]; size_t n_iovec = 0; uid_t owner_uid; const char *p; @@ -1110,6 +1111,15 @@ static int process_kernel(int argc, char* argv[]) { IOVEC_SET_STRING(iovec[n_iovec++], core_proc_cgroup); } + p = procfs_file_alloca(pid, "mountinfo"); + if (read_full_file(p, &t, NULL) >=0) { + core_proc_mountinfo = strappend("COREDUMP_PROC_MOUNTINFO=", t); + free(t); + + if (core_proc_mountinfo) + IOVEC_SET_STRING(iovec[n_iovec++], core_proc_mountinfo); + } + if (get_process_cwd(pid, &t) >= 0) { core_cwd = strjoina("COREDUMP_CWD=", t); free(t); |