]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredump: save /proc/[pid]/mountinfo
authorJakub Filak <jfilak@redhat.com>
Tue, 26 Apr 2016 07:54:39 +0000 (09:54 +0200)
committerJakub Filak <jfilak@redhat.com>
Tue, 2 Aug 2016 08:00:46 +0000 (10:00 +0200)
The file contains information one can use to debug processes running
within a container.

src/coredump/coredump.c

index dcc09fcc6d60139d98a92bd82e7075a1cb33142c..953f04e205c4253ce1ece52fad08a34d5dec982d 100644 (file)
@@ -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);