tree-wide: drop DLOPEN_FOO() macros

Since 4c0d8d9673, most dlopen notes are
set at the beginning of the executables. Let's manage all dlopen notes
there, rather than setting them where dlopen is called.

Note that the only exceptions are the LIBBPF_NOTE for networkd and
nsresource. Since dlopen_bpf() is wrapped in an `#if` guard, the notes
are instead set within the corresponding functionality.

As a result, the DLOPEN_FOO() wrapper macros are no longer needed and
can be dropped completely.
This commit is contained in:
Yu Watanabe
2026-07-18 04:56:32 +09:00
parent e056e2a707
commit 661ab8b6fd
94 changed files with 223 additions and 233 deletions
+8 -8
View File
@@ -1311,7 +1311,7 @@ static int setup_pam(
* parent process will exec() the actual daemon. We do things this way to ensure that the main PID of
* the daemon is the one we initially fork()ed. */
r = DLOPEN_LIBPAM(LOG_ERR, recommended);
r = dlopen_libpam(LOG_ERR);
if (r < 0)
return r;
@@ -1578,7 +1578,7 @@ static bool seccomp_allows_drop_privileges(const ExecContext *c) {
assert(c);
/* No libseccomp, all is fine */
if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) < 0)
if (dlopen_libseccomp(LOG_DEBUG) < 0)
return true;
/* No syscall filter, we are allowed to drop privileges */
@@ -1888,7 +1888,7 @@ static int apply_restrict_filesystems(const ExecContext *c, const ExecParameters
}
/* We are in a new binary, so dl-open again */
r = DLOPEN_BPF(LOG_DEBUG, recommended);
r = dlopen_bpf(LOG_DEBUG);
if (r < 0)
return r;
@@ -6006,12 +6006,12 @@ int exec_invoke(
}
/* Load a bunch of libraries we'll possibly need later, before we turn off dlopen() */
(void) DLOPEN_BPF(LOG_DEBUG, recommended);
(void) DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
(void) DLOPEN_LIBMOUNT(LOG_DEBUG, recommended);
(void) DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended);
(void) dlopen_bpf(LOG_DEBUG);
(void) dlopen_cryptsetup(LOG_DEBUG);
(void) dlopen_libmount(LOG_DEBUG);
(void) dlopen_libseccomp(LOG_DEBUG);
/* Needed for userspace verity verification fallback */
(void) DLOPEN_LIBCRYPTO(LOG_DEBUG, recommended);
(void) dlopen_libcrypto(LOG_DEBUG);
/* Let's now disable further dlopen()ing of libraries, since we are about to do namespace
* shenanigans, and do not want to mix resources from host and namespace */