Commit f1708959 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

dump: Allow parasite-dumper to write pages with non-privileged process

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 8bbed969
......@@ -15,7 +15,8 @@ int cr_restore_tasks(pid_t pid, bool leader_only, int leave_stopped);
int cr_show(unsigned long pid, bool leader_only);
int convert_to_elf(char *elf_path, int fd_core);
#define CR_FD_PERM 0600
#define CR_FD_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
#define CR_FD_PERM_DUMP (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
enum {
CR_FD_FDINFO,
......
......@@ -242,6 +242,8 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
goto err;
}
jerr(fchmod(cr_fdset->desc[fd_type].fd, CR_FD_PERM_DUMP), err);
jerr(ptrace(PTRACE_GETREGS, ctl->pid, NULL, &regs_orig), err);
parasite_arg.command = PARASITE_CMD_DUMPPAGES;
......@@ -251,7 +253,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
strncpy(parasite_dumppages.open_path, cr_fdset->desc[fd_type].name,
sizeof(parasite_dumppages.open_path));
parasite_dumppages.open_flags = O_WRONLY;
parasite_dumppages.open_mode = CR_FD_PERM;
parasite_dumppages.open_mode = CR_FD_PERM_DUMP;
parasite_dumppages.fd = -1UL;
/*
......@@ -384,6 +386,7 @@ err_restore:
if (ptrace(PTRACE_SETREGS, (long)ctl->pid, NULL, &regs_orig))
pr_panic("Can't restore registers (pid: %d)\n", ctl->pid);
jerr(fchmod(cr_fdset->desc[fd_type].fd, CR_FD_PERM), err);
err:
pr_info("----------------------------------------\n");
......
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