diff --git a/kerndat.c b/kerndat.c index 90263a9b3..9c5157d4a 100644 --- a/kerndat.c +++ b/kerndat.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "log.h" #include "kerndat.h" @@ -71,6 +72,12 @@ int kerndat_get_dirty_track(void) pm2 = open("/proc/self/pagemap2", O_RDONLY); if (pm2 < 0) { + munmap(map, PAGE_SIZE); + if (errno == ENOENT) { + pr_info("No pagemap2 file\n"); + return 0; + } + pr_perror("Can't open pagemap2 file"); return ret; } diff --git a/mem.c b/mem.c index 277ecf460..b54723dd9 100644 --- a/mem.c +++ b/mem.c @@ -315,8 +315,14 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl, goto out_snap; ret = pagemap = open_proc(ctl->pid.real, "pagemap2"); - if (ret < 0) - goto out_free; + if (ret < 0) { + if (errno != ENOENT) + goto out_free; + + ret = pagemap = open_proc(ctl->pid.real, "pagemap"); + if (ret < 0) + goto out_free; + } ret = -1; pp = create_page_pipe(vma_area_list->priv_size / 2, args->iovs);