File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 28
28
#include <compel/plugins/std/syscall.h>
29
29
#include <compel/plugins/std/log.h>
30
30
#include <compel/ksigset.h>
31
+ #include "mman.h"
31
32
#include "signal.h"
32
33
#include "prctl.h"
33
34
#include "criu-log.h"
@@ -1665,6 +1666,30 @@ static int restore_membarrier_registrations(int mask)
1665
1666
return ret ;
1666
1667
}
1667
1668
1669
+ static int restore_madv_guard_regions (struct task_restore_args * args )
1670
+ {
1671
+ int i , ret ;
1672
+
1673
+ for (i = 0 ; i < args -> vmas_n ; i ++ ) {
1674
+ VmaEntry * vma_entry = args -> vmas + i ;
1675
+ size_t len ;
1676
+
1677
+ if (!vma_entry_is (vma_entry , VMA_AREA_GUARD ))
1678
+ continue ;
1679
+
1680
+ len = vma_entry -> end - vma_entry -> start ;
1681
+ ret = sys_madvise (vma_entry -> start , len , MADV_GUARD_INSTALL );
1682
+ if (ret ) {
1683
+ pr_err ("madvise(%" PRIx64 ", %zu, MADV_GUARD_INSTALL) "
1684
+ "failed with %d\n" ,
1685
+ vma_entry -> start , len , ret );
1686
+ return -1 ;
1687
+ }
1688
+ }
1689
+
1690
+ return 0 ;
1691
+ }
1692
+
1668
1693
/*
1669
1694
* The main routine to restore task via sigreturn.
1670
1695
* This one is very special, we never return there
@@ -1972,6 +1997,13 @@ __visible long __export_restore_task(struct task_restore_args *args)
1972
1997
}
1973
1998
}
1974
1999
2000
+ /*
2001
+ * Restore madvise(MADV_GUARD_INSTALL)
2002
+ */
2003
+ ret = restore_madv_guard_regions (args );
2004
+ if (ret )
2005
+ goto core_restore_end ;
2006
+
1975
2007
/*
1976
2008
* Tune up the task fields.
1977
2009
*/
You can’t perform that action at this time.
0 commit comments