summaryrefslogtreecommitdiff
path: root/arch/um
diff options
context:
space:
mode:
authorBenjamin Berg <benjamin.berg@intel.com>2024-11-03 16:05:02 +0100
committerJohannes Berg <johannes.berg@intel.com>2024-11-07 17:36:30 +0100
commitfce0128863b22dd6d9a4e5383645ac70656970a7 (patch)
treea1a2328499a7faf43b904047d6bc4d0a3f461108 /arch/um
parent81e0679d851ad7ddee8904df59f84eabfc2c1b1e (diff)
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 <benjamin.berg@intel.com> Link: https://patch.msgid.link/20241103150506.1367695-1-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/os-Linux/mem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 857e3deab293..72f302f4d197 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -39,6 +39,18 @@ void kasan_map_memory(void *start, size_t len)
strerror(errno));
exit(1);
}
+
+ if (madvise(start, len, MADV_DONTDUMP)) {
+ os_info("Couldn't set MAD_DONTDUMP on shadow memory: %s\n.",
+ strerror(errno));
+ exit(1);
+ }
+
+ if (madvise(start, len, MADV_DONTFORK)) {
+ os_info("Couldn't set MADV_DONTFORK on shadow memory: %s\n.",
+ strerror(errno));
+ exit(1);
+ }
}
/* Set by make_tempfile() during early boot. */