]> git.ipfire.org Git - thirdparty/systemd.git/commit
Do not use "critical assert_return" in libsystemd or libudev
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Oct 2025 18:44:05 +0000 (20:44 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 6 Nov 2025 21:26:42 +0000 (21:26 +0000)
commit9c1db4cd8e0dfeb2d35f9720236b1bcc9844db23
tree260c61119f53e044499b8b206682845b848eabbc
parent29cbe93ea5e845f6621c44dd73b0f3ebfbe7ddf4
Do not use "critical assert_return" in libsystemd or libudev

Previously, when compiled in developer mode, a call into libsystemd with
invalid parameters would result in an abort. This means that it's effectively
impossible to install such libsystemd in a normal system, since various
third-party programs may now abort. A shared library should generally never
abort or exit the calling program.

In python-systemd, the test suite calls into libsystemd, to check if the proper
return values are received and propagated through the Python wrappers.
Obviously with libsystemd compiled from git, the test suite now fails
in a nasty way.

So rework the code to set assert_return_is_critical similarly to how we handle
mempool enablement: the function that returns true is declared as a week
symbol, and we "opt in" by linking a file that provides the function in
libsystemd-shared. Effectively, libsystemd and libudev always have
assert_return_is_critical==false, and our binaries and modules enable it
conditionally.

(cherry picked from commit 0bb0316f5eb2c8d30e91feac571404687c6a0dc2)
src/basic/assert-util.c
src/basic/assert-util.h
src/fuzz/fuzz.h
src/shared/log-assert-critical.c [new file with mode: 0644]
src/shared/log-assert-critical.h [new file with mode: 0644]
src/shared/meson.build
src/shared/nss-util.c
src/shared/tests.h