mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
parasite: Fix exchang area size handling
Wrong size was used in mapping and unmapping. But since they are more-less close to each other, nobody noticed it. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -755,7 +755,7 @@ int parasite_cure_seized(struct parasite_ctl *ctl, struct pstree_item *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctl->local_map) {
|
if (ctl->local_map) {
|
||||||
if (munmap(ctl->local_map, parasite_size)) {
|
if (munmap(ctl->local_map, ctl->map_length)) {
|
||||||
pr_err("munmap failed (pid: %d)\n", ctl->pid);
|
pr_err("munmap failed (pid: %d)\n", ctl->pid);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ int parasite_map_exchange(struct parasite_ctl *ctl, unsigned long size)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
ctl->remote_map = mmap_seized(ctl, NULL, (size_t)parasite_size,
|
ctl->remote_map = mmap_seized(ctl, NULL, size,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
||||||
if (!ctl->remote_map) {
|
if (!ctl->remote_map) {
|
||||||
@@ -840,14 +840,14 @@ int parasite_map_exchange(struct parasite_ctl *ctl, unsigned long size)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctl->map_length = round_up(parasite_size, PAGE_SIZE);
|
ctl->map_length = round_up(size, PAGE_SIZE);
|
||||||
|
|
||||||
fd = open_proc_rw(ctl->pid, "map_files/%p-%p",
|
fd = open_proc_rw(ctl->pid, "map_files/%p-%p",
|
||||||
ctl->remote_map, ctl->remote_map + ctl->map_length);
|
ctl->remote_map, ctl->remote_map + ctl->map_length);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ctl->local_map = mmap(NULL, parasite_size, PROT_READ | PROT_WRITE,
|
ctl->local_map = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED | MAP_FILE, fd, 0);
|
MAP_SHARED | MAP_FILE, fd, 0);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user