Commit 75d8b81f authored by Pavel Emelyanov's avatar Pavel Emelyanov

ipc: Check for IPC namespace to be dumped when such mapping is

If any task has a sysvipc mapping we should make sure, that the
ipc namespace is dumped as well. Otherwise after restore the task
will die.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 09ebdd45
...@@ -333,6 +333,16 @@ static int dump_filemap(pid_t pid, VmaEntry *vma, int file_fd, ...@@ -333,6 +333,16 @@ static int dump_filemap(pid_t pid, VmaEntry *vma, int file_fd,
return dump_one_reg_file(file_fd, vma->shmid, &p); return dump_one_reg_file(file_fd, vma->shmid, &p);
} }
static int check_sysvipc_map_dump(pid_t pid, VmaEntry *vma)
{
if (current_ns_mask & CLONE_NEWIPC)
return 0;
pr_err("Task %d with SysVIPC shmem map @%lx doesn't live in IPC ns\n",
pid, vma->start);
return -1;
}
static int dump_task_mappings(pid_t pid, const struct vm_area_list *vma_area_list, static int dump_task_mappings(pid_t pid, const struct vm_area_list *vma_area_list,
const struct cr_fdset *cr_fdset) const struct cr_fdset *cr_fdset)
{ {
...@@ -350,9 +360,10 @@ static int dump_task_mappings(pid_t pid, const struct vm_area_list *vma_area_lis ...@@ -350,9 +360,10 @@ static int dump_task_mappings(pid_t pid, const struct vm_area_list *vma_area_lis
pr_info_vma(vma_area); pr_info_vma(vma_area);
if (!vma_entry_is(vma, VMA_AREA_REGULAR) || if (!vma_entry_is(vma, VMA_AREA_REGULAR))
vma_entry_is(vma, VMA_AREA_SYSVIPC))
ret = 0; ret = 0;
else if (vma_entry_is(vma, VMA_AREA_SYSVIPC))
ret = check_sysvipc_map_dump(pid, vma);
else if (vma_entry_is(vma, VMA_ANON_SHARED)) else if (vma_entry_is(vma, VMA_ANON_SHARED))
ret = add_shmem_area(pid, vma); ret = add_shmem_area(pid, vma);
else if (vma_entry_is(vma, VMA_FILE_PRIVATE) || else if (vma_entry_is(vma, VMA_FILE_PRIVATE) ||
......
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