summaryrefslogtreecommitdiff
path: root/mkosi.postinst
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-07-15 02:26:52 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-07-18 16:54:56 +0200
commit69d638e67e5bfc5fedcae4072f144a4f7d798c9a (patch)
tree7609b870b6116e04516fb3bb2901d9f64e65434c /mkosi.postinst
parent111ff5d5115cb2f49aba59da5dbdf96a28d0974d (diff)
downloadsystemd-69d638e67e5bfc5fedcae4072f144a4f7d798c9a.tar.gz
mkosi: Changes to allow booting with sanitizers in mkosi
- Extra memory because ASAN needs it - The environment variables to make the sanitizers more useful - LD_PRELOAD because the ASAN DSO needs to be the first in the list - The sanitizer library packages - Disable syscall filters because they interfere with ASAN - Disable systemd-hwdb-update because it's super slow when systemd-hwdb is built with sanitizers - Take the value for meson's b_sanitize option from the SANITIZERS environment variable
Diffstat (limited to 'mkosi.postinst')
-rwxr-xr-xmkosi.postinst14
1 files changed, 12 insertions, 2 deletions
diff --git a/mkosi.postinst b/mkosi.postinst
index 6eddadfea8..8817818a94 100755
--- a/mkosi.postinst
+++ b/mkosi.postinst
@@ -1,8 +1,18 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
-if [ "$1" = "final" ] && command -v bootctl > /dev/null && [ -d "/efi" ]; then
- bootctl install
+if [ "$1" = "final" ]; then
+ if command -v bootctl > /dev/null && [ -d "/efi" ]; then
+ bootctl install
+ fi
+
+ if [ -n "$SANITIZERS" ]; then
+ # ASAN and syscall filters aren't compatible with each other.
+ find / -name '*.service' -type f -exec sed -i 's/^\(MemoryDeny\|SystemCall\)/# \1/' {} +
+
+ # `systemd-hwdb update` takes > 50s when built with sanitizers so let's not run it by default.
+ systemctl mask systemd-hwdb-update.service
+ fi
fi
# Temporary workaround until https://github.com/openSUSE/suse-module-tools/commit/158643414ddb8d8208016a5f03a4484d58944d7a