Commit 24f0f498 authored by Pavel Emelyanov's avatar Pavel Emelyanov

pstree_item: Keep creds field on dump_info tail

And rename it for easier grepping
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 063c5b89
...@@ -678,10 +678,10 @@ static int dump_task_core_all(struct pstree_item *item, ...@@ -678,10 +678,10 @@ static int dump_task_core_all(struct pstree_item *item,
if (ret < 0) if (ret < 0)
goto err; goto err;
if (item->creds->seccomp_mode != SECCOMP_MODE_DISABLED) { if (dmpi(item)->pi_creds->seccomp_mode != SECCOMP_MODE_DISABLED) {
pr_info("got seccomp mode %d for %d\n", item->creds->seccomp_mode, item->pid.virt); pr_info("got seccomp mode %d for %d\n", dmpi(item)->pi_creds->seccomp_mode, item->pid.virt);
core->tc->has_seccomp_mode = true; core->tc->has_seccomp_mode = true;
core->tc->seccomp_mode = item->creds->seccomp_mode; core->tc->seccomp_mode = dmpi(item)->pi_creds->seccomp_mode;
} }
strncpy((char *)core->tc->comm, stat->comm, TASK_COMM_LEN); strncpy((char *)core->tc->comm, stat->comm, TASK_COMM_LEN);
...@@ -813,7 +813,7 @@ static int collect_children(struct pstree_item *item) ...@@ -813,7 +813,7 @@ static int collect_children(struct pstree_item *item)
goto free; goto free;
} }
ret = seize_task(pid, item->pid.real, &c->creds); ret = seize_task(pid, item->pid.real, &dmpi(c)->pi_creds);
if (ret < 0) { if (ret < 0) {
/* /*
* Here is a race window between parse_children() and seize(), * Here is a race window between parse_children() and seize(),
...@@ -962,7 +962,7 @@ static int collect_threads(struct pstree_item *item) ...@@ -962,7 +962,7 @@ static int collect_threads(struct pstree_item *item)
pr_info("\tSeizing %d's %d thread\n", pr_info("\tSeizing %d's %d thread\n",
item->pid.real, pid); item->pid.real, pid);
ret = seize_task(pid, item_ppid(item), &item->creds); ret = seize_task(pid, item_ppid(item), &dmpi(item)->pi_creds);
if (ret < 0) { if (ret < 0) {
/* /*
* Here is a race window between parse_threads() and seize(), * Here is a race window between parse_threads() and seize(),
...@@ -1112,7 +1112,7 @@ static int collect_pstree(pid_t pid) ...@@ -1112,7 +1112,7 @@ static int collect_pstree(pid_t pid)
return -1; return -1;
root_item->pid.real = pid; root_item->pid.real = pid;
ret = seize_task(pid, -1, &root_item->creds); ret = seize_task(pid, -1, &dmpi(root_item)->pi_creds);
if (ret < 0) if (ret < 0)
goto err; goto err;
pr_info("Seized task %d, state %d\n", pid, ret); pr_info("Seized task %d, state %d\n", pid, ret);
......
...@@ -30,12 +30,6 @@ struct pstree_item { ...@@ -30,12 +30,6 @@ struct pstree_item {
*/ */
bool has_seccomp; bool has_seccomp;
/*
* We keep the creds here so that we can compare creds while seizing
* threads. Dumping tasks with different creds is not supported.
*/
struct proc_status_creds *creds;
int nr_threads; /* number of threads */ int nr_threads; /* number of threads */
struct pid *threads; /* array of threads */ struct pid *threads; /* array of threads */
CoreEntry **core; CoreEntry **core;
...@@ -51,6 +45,12 @@ static inline struct rst_info *rsti(struct pstree_item *i) ...@@ -51,6 +45,12 @@ static inline struct rst_info *rsti(struct pstree_item *i)
struct ns_id; struct ns_id;
struct dmp_info { struct dmp_info {
struct ns_id *netns; struct ns_id *netns;
/*
* We keep the creds here so that we can compare creds while seizing
* threads. Dumping tasks with different creds is not supported.
*/
struct proc_status_creds *pi_creds;
}; };
static inline struct dmp_info *dmpi(struct pstree_item *i) static inline struct dmp_info *dmpi(struct pstree_item *i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment