[CRIU] [PATCH] irmap: Duplicate handle memory when queueing for predump
Pavel Emelyanov
xemul at virtuozzo.com
Thu Jun 29 10:35:12 MSK 2017
With the recent cleanups in fdinfo parsing the memory
allocation policy for entries has changed, thus keeping
a pointer on the entry handle is no longer valid (it
will be freed soon).
Said that -- duplicate the memory for queued irmap work.
https://github.com/xemul/criu/issues/328
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/irmap.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/criu/irmap.c b/criu/irmap.c
index c27fdd7..107e0f2 100644
--- a/criu/irmap.c
+++ b/criu/irmap.c
@@ -311,7 +311,12 @@ int irmap_queue_cache(unsigned int dev, unsigned long ino,
ip->dev = dev;
ip->ino = ino;
ip->fh = *fh;
- fh->handle = NULL; /* don't free in free_fhandle */
+ ip->fh.handle = xmemdup(fh->handle,
+ FH_ENTRY_SIZES__min_entries * sizeof(uint64_t));
+ if (!ip->fh.handle) {
+ xfree(ip);
+ return -1;
+ }
pr_debug("Queue %x:%lx for pre-dump\n", dev, ino);
--
2.1.4
More information about the CRIU
mailing list