Commit 389bd830 authored by Kinsbursky Stanislav's avatar Kinsbursky Stanislav Committed by Cyrill Gorcunov

restorer: Don't close SYSV IPC vma fd

It's not a fd to open and map, but SYSV IPC id instead.
So don't close it - this may lead to unpredictable results
(in case of SYSV IPC id will match fd, opened by processes).
Signed-off-by: 's avatarStanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent e1cac86b
......@@ -291,6 +291,7 @@ static u64 restore_mapping(const struct vma_entry *vma_entry)
{
int prot = vma_entry->prot;
int flags = vma_entry->flags | MAP_FIXED;
u64 addr;
if (vma_entry_is(vma_entry, VMA_AREA_SYSVIPC))
return sys_shmat(vma_entry->fd, (void *)vma_entry->start,
......@@ -316,11 +317,16 @@ static u64 restore_mapping(const struct vma_entry *vma_entry)
* writable since we're going to restore page
* contents.
*/
return sys_mmap((void *)vma_entry->start,
addr = sys_mmap((void *)vma_entry->start,
vma_entry_len(vma_entry),
prot, flags,
vma_entry->fd,
vma_entry->pgoff);
if (vma_entry->fd != -1)
sys_close(vma_entry->fd);
return addr;
}
/*
......
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