analyze: Add dlopen-metadata verb

systemd-analyze dlopen-metadata will show dlopen metadata
in the ELF binary.
This commit is contained in:
Daan De Meyer
2025-10-26 19:41:27 +01:00
parent da30f59f60
commit 0fe29d0672
6 changed files with 98 additions and 0 deletions

View File

@@ -1006,7 +1006,16 @@ systemd-analyze security --threshold=25 --offline=true \
rm /tmp/img/usr/lib/systemd/system/testfile.service
if systemd-analyze --version | grep -q -F "+ELFUTILS"; then
systemd-analyze inspect-elf /lib/systemd/systemd
systemd-analyze inspect-elf --json=short /lib/systemd/systemd | grep -q -F '"elfType":"executable"'
# For some unknown reason the .note.dlopen sections are removed when building with sanitizers, so only
# run this test if we're not running under sanitizers.
if [[ ! -v ASAN_OPTIONS ]]; then
shared="$(ldd /lib/systemd/systemd | grep shared | cut -d' ' -f3)"
systemd-analyze dlopen-metadata "$shared"
systemd-analyze dlopen-metadata --json=short "$shared"
fi
fi
systemd-analyze --threshold=90 security systemd-journald.service