Skip to content

Commit fce0128

Browse files
benzeajmberg-intel
authored andcommitted
um: set DONTDUMP and DONTFORK flags on KASAN shadow memory
There is no point in either dumping the KASAN shadow memory or doing copy-on-write after a fork on these memory regions. This considerably speeds up coredump generation. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 81e0679 commit fce0128

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/um/os-Linux/mem.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ void kasan_map_memory(void *start, size_t len)
3939
strerror(errno));
4040
exit(1);
4141
}
42+
43+
if (madvise(start, len, MADV_DONTDUMP)) {
44+
os_info("Couldn't set MAD_DONTDUMP on shadow memory: %s\n.",
45+
strerror(errno));
46+
exit(1);
47+
}
48+
49+
if (madvise(start, len, MADV_DONTFORK)) {
50+
os_info("Couldn't set MADV_DONTFORK on shadow memory: %s\n.",
51+
strerror(errno));
52+
exit(1);
53+
}
4254
}
4355

4456
/* Set by make_tempfile() during early boot. */

0 commit comments

Comments
 (0)