mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
dump: Allow parasite-dumper to write pages with non-privileged process
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
8bbed96981
commit
f170895975
2 changed files with 6 additions and 2 deletions
|
|
@ -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, ®s_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, ®s_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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue