2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

criu/proc_parse: support MADV_WIPEONFORK/VM_WIPEONFORK

Support VM_WIPEONFORK [1] by detecting it from /proc/<pid>/smaps
and setting a corresponding MADV_WIPEONFORK flag on vma.

[1] d2cd9ede6e

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
This commit is contained in:
Alexander Mikhalitsyn 2025-05-04 16:27:32 +02:00 committed by Andrei Vagin
parent 3a3a3f0f27
commit 777c0a7632
2 changed files with 5 additions and 0 deletions

View File

@ -13,5 +13,8 @@
#ifndef MADV_DONTDUMP
#define MADV_DONTDUMP 16
#endif
#ifndef MADV_WIPEONFORK
#define MADV_WIPEONFORK 18
#endif
#endif /* __CR_MMAN_H__ */

View File

@ -160,6 +160,8 @@ static void __parse_vmflags(char *buf, u32 *flags, u64 *madv, int *io_pf,
*madv |= (1ul << MADV_HUGEPAGE);
else if (_vmflag_match(tok, "nh"))
*madv |= (1ul << MADV_NOHUGEPAGE);
else if (_vmflag_match(tok, "wf"))
*madv |= (1ul << MADV_WIPEONFORK);
/* vmsplice doesn't work for VM_IO and VM_PFNMAP mappings. */
if (_vmflag_match(tok, "io") || _vmflag_match(tok, "pf"))