0

When I use asan to compile the rpm package of systemd:

  1. Add the following information to the systemd.spec file:

export CFLAGS="$RPM_OPT_FLAGS"

export LDFLAGS=$RPM_LD_FLAGS

CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer-fsanitize-recover=address"

LDFLAGS="$LDFLAGS -fsanitize=address -fno-omit-frame-pointer-fsanitize-recover=address"

  1. Run the rpmbuild -ba command to generate RPM packages.

Then use the rpm to upgrade the system:rpm -Uvh systemd*.rpm However, the system fails to be started: Failed to start Load/Save Random Seed.

Some failed services will prompt such as:

systemd[1]: Starting Load/Save Random Seed... systemd-random-seed[2939]: ==2939==Can't open /proc/2457614/task for reading. systemd-random-seed[2939]: ==2939==LeakSanitizer has encountered a fatal error. systemd-random-seed[2939]: ==2939==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1 systemd-random-seed[2939]: ==2939==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc) systemd[1]: Failed to start Load/Save Random Seed.

By the way, when I enter emergency mode and execute __lsan_do_recoverable_leak_check in systemd, systemd exits.

How to Run Systemd with Asan (Address Sanitizer)?

huyubiao
  • 1
  • 1

0 Answers0