Commit f787f922 authored by Pavel Emelyanov's avatar Pavel Emelyanov

dump: Pass CoreEntry into thread-dumping routine

The number of arguments used to carry data via them is too
big already. Just fill the required core fields inside.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e129ae26
...@@ -1156,9 +1156,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid) ...@@ -1156,9 +1156,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
{ {
CoreEntry *core; CoreEntry *core;
int ret = -1, fd_core; int ret = -1, fd_core;
unsigned int *taddr;
pid_t pid = tid->real; pid_t pid = tid->real;
u32 tls;
pr_info("\n"); pr_info("\n");
pr_info("Dumping core for thread (pid: %d)\n", pid); pr_info("Dumping core for thread (pid: %d)\n", pid);
...@@ -1176,20 +1174,13 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid) ...@@ -1176,20 +1174,13 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
if (ret) if (ret)
goto err_free; goto err_free;
ret = parasite_dump_thread_seized(parasite_ctl, tid, &taddr, ret = parasite_dump_thread_seized(parasite_ctl, tid, core);
&core->thread_core->blk_sigset,
&tls);
if (ret) { if (ret) {
pr_err("Can't dump thread for pid %d\n", pid); pr_err("Can't dump thread for pid %d\n", pid);
goto err_free; goto err_free;
} }
core->thread_core->has_blk_sigset = true;
core_put_tls(core, tls);
pr_info("%d: virt_pid=%d tid_address=%p sig_blocked=0x%lx\n", pid, core->thread_core->has_blk_sigset = true;
tid->virt, taddr, core->thread_core->blk_sigset);
core->thread_info->clear_tid_addr = (u64) taddr;
ret = dump_sched_info(pid, core->thread_core); ret = dump_sched_info(pid, core->thread_core);
if (ret) if (ret)
......
...@@ -37,9 +37,9 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl, ...@@ -37,9 +37,9 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl,
struct cr_fdset *cr_fdset); struct cr_fdset *cr_fdset);
struct parasite_dump_thread; struct parasite_dump_thread;
struct pid; struct pid;
struct _CoreEntry;
extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid, extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid,
unsigned int **tid_add, struct _CoreEntry *core);
void *blocked, u32 *tls);
struct parasite_drain_fd; struct parasite_drain_fd;
struct fd_opts; struct fd_opts;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "protobuf/sa.pb-c.h" #include "protobuf/sa.pb-c.h"
#include "protobuf/itimer.pb-c.h" #include "protobuf/itimer.pb-c.h"
#include "protobuf/creds.pb-c.h" #include "protobuf/creds.pb-c.h"
#include "protobuf/core.pb-c.h"
#include "syscall.h" #include "syscall.h"
#include "ptrace.h" #include "ptrace.h"
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
#include "asm/parasite-syscall.h" #include "asm/parasite-syscall.h"
#include "asm/dump.h"
#define parasite_size (round_up(sizeof(parasite_blob), sizeof(long))) #define parasite_size (round_up(sizeof(parasite_blob), sizeof(long)))
...@@ -365,9 +367,7 @@ err: ...@@ -365,9 +367,7 @@ err:
} }
int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid, int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid,
unsigned int **tid_addr, CoreEntry *core)
void *blocked,
u32 *tls)
{ {
struct parasite_dump_thread *args; struct parasite_dump_thread *args;
int ret; int ret;
...@@ -376,10 +376,10 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid, ...@@ -376,10 +376,10 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, struct pid *tid,
ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD, ctl, tid->real); ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD, ctl, tid->real);
memcpy(blocked, &args->blocked, sizeof(args->blocked)); memcpy(&core->thread_core->blk_sigset, &args->blocked, sizeof(args->blocked));
*tid_addr = args->tid_addr; core->thread_info->clear_tid_addr = (u64)args->tid_addr;
tid->virt = args->tid; tid->virt = args->tid;
*tls = args->tls; core_put_tls(core, args->tls);
return ret; return ret;
} }
......
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