Commit 1d6578bb authored by Pavel Emelyanov's avatar Pavel Emelyanov

kcmp: Dump task's objects shared with CLONE_ flags

Just dump their IDs and check they are not shared. For future.
IO and SEMUNDO is not there since tasks may have NO such objects
and currently we cannot detect whether they have them equal or
both don't have.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 33865354
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "types.h" #include "types.h"
#include "list.h" #include "list.h"
#include "file-ids.h" #include "file-ids.h"
#include "kcmp-ids.h"
#include "compiler.h" #include "compiler.h"
#include "crtools.h" #include "crtools.h"
#include "syscall.h" #include "syscall.h"
...@@ -853,6 +853,51 @@ static int dump_task_core(struct core_entry *core, int fd_core) ...@@ -853,6 +853,51 @@ static int dump_task_core(struct core_entry *core, int fd_core)
return write_img(fd_core, core); return write_img(fd_core, core);
} }
static DECLARE_KCMP_TREE(vm_tree, KCMP_VM);
static DECLARE_KCMP_TREE(fs_tree, KCMP_FS);
static DECLARE_KCMP_TREE(files_tree, KCMP_FILES);
static DECLARE_KCMP_TREE(sighand_tree, KCMP_SIGHAND);
static int dump_task_kobj_ids(pid_t pid, struct core_entry *core)
{
int new;
struct kid_elem elem;
elem.pid = pid;
elem.idx = 0; /* really 0 for all */
elem.genid = 0; /* FIXME optimize */
new = 0;
core->ids.vm_id = kid_generate_gen(&vm_tree, &elem, &new);
if (!core->ids.vm_id || !new) {
pr_err("Can't make VM id for %d\n", pid);
return -1;
}
new = 0;
core->ids.fs_id = kid_generate_gen(&fs_tree, &elem, &new);
if (!core->ids.fs_id || !new) {
pr_err("Can't make FS id for %d\n", pid);
return -1;
}
new = 0;
core->ids.files_id = kid_generate_gen(&files_tree, &elem, &new);
if (!core->ids.files_id || !new) {
pr_err("Can't make FILES id for %d\n", pid);
return -1;
}
new = 0;
core->ids.sighand_id = kid_generate_gen(&sighand_tree, &elem, &new);
if (!core->ids.sighand_id || !new) {
pr_err("Can't make IO id for %d\n", pid);
return -1;
}
return 0;
}
static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat, static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat,
const struct parasite_dump_misc *misc, const struct parasite_ctl *ctl, const struct parasite_dump_misc *misc, const struct parasite_ctl *ctl,
const struct cr_fdset *cr_fdset) const struct cr_fdset *cr_fdset)
...@@ -868,6 +913,10 @@ static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat, ...@@ -868,6 +913,10 @@ static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat,
if (!core) if (!core)
goto err; goto err;
ret = dump_task_kobj_ids(pid, core);
if (ret)
goto err_free;
pr_info("Dumping GP/FPU registers ... "); pr_info("Dumping GP/FPU registers ... ");
ret = get_task_regs(pid, core, ctl); ret = get_task_regs(pid, core, ctl);
if (ret) if (ret)
......
...@@ -479,6 +479,22 @@ err: ...@@ -479,6 +479,22 @@ err:
return; return;
} }
static void show_core_ids(int fd)
{
struct core_ids_entry cie;
lseek(fd, GET_FILE_OFF(struct core_entry, ids), SEEK_SET);
if (read_img(fd, &cie) < 0)
goto err;
pr_msg("\tVM: %x\n", cie.vm_id);
pr_msg("\tFS: %x\n", cie.fs_id);
pr_msg("\tFILES: %x\n", cie.files_id);
pr_msg("\tSIGHAND: %x\n", cie.sighand_id);
err:
return;
}
void show_core(int fd_core, struct cr_options *o) void show_core(int fd_core, struct cr_options *o)
{ {
struct stat stat; struct stat stat;
...@@ -498,6 +514,7 @@ void show_core(int fd_core, struct cr_options *o) ...@@ -498,6 +514,7 @@ void show_core(int fd_core, struct cr_options *o)
show_core_regs(fd_core); show_core_regs(fd_core);
show_core_rest(fd_core); show_core_rest(fd_core);
show_core_ids(fd_core);
out: out:
pr_img_tail(CR_FD_CORE); pr_img_tail(CR_FD_CORE);
} }
......
...@@ -370,12 +370,20 @@ struct mm_entry { ...@@ -370,12 +370,20 @@ struct mm_entry {
u32 exe_file_id; u32 exe_file_id;
} __packed; } __packed;
struct core_ids_entry {
u32 vm_id;
u32 files_id;
u32 fs_id;
u32 sighand_id;
} __packed;
struct core_entry { struct core_entry {
union { union {
struct { struct {
struct image_header header; struct image_header header;
struct task_core_entry tc; struct task_core_entry tc;
struct ckpt_arch_entry arch; struct ckpt_arch_entry arch;
struct core_ids_entry ids;
u64 clear_tid_address; u64 clear_tid_address;
}; };
u8 __core_pad[CKPT_CORE_SIZE]; u8 __core_pad[CKPT_CORE_SIZE];
......
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