This also switches all these notes to be defined via SD_ELF_NOTE_DLOPEN_ANCHORED().
Consequently, any notes added within unreachable or unused functions will be
automatically garbage-collected by the linker (--gc-sections) instead of
bloating the final binary.
E.g. unused p11-kit library dependency is now dropped from
systemd-repart.standalone binary.
Before:
```
$ systemd-analyze dlopen-metadata build/systemd-repart.standalone
FEATURE DESCRIPTION SONAME PRIORITY
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12 recommended
blkid Support for block device identification libblkid.so.1 required
libcrypto Support for cryptographic operations libcrypto.so.4 libcrypto.so.3 recommended
mount Support for mount enumeration libmount.so.1 required
fdisk Support for reading and writing partition tables libfdisk.so.1 required
blkid Support for block device identification libblkid.so.1 recommended
libcrypto Support for cryptographic operations libcrypto.so.4 libcrypto.so.3 suggested
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12 suggested
fdisk Support for reading and writing partition tables libfdisk.so.1 suggested
idn Support for internationalized domain names libidn2.so.0 suggested
mount Support for mount enumeration libmount.so.1 recommended
selinux Support for SELinux libselinux.so.1 recommended
tpm Support for TPM libtss2-esys.so.0 suggested
tpm Support for TPM libtss2-rc.so.0 suggested
tpm Support for TPM libtss2-mu.so.0 suggested
tpm Support for TPM libtss2-tcti-device.so.0 suggested
p11-kit Support for PKCS11 hardware tokens libp11-kit.so.0 suggested
```
After:
```
$ systemd-analyze dlopen-metadata build/systemd-repart.standalone
FEATURE DESCRIPTION SONAME PRIORITY
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12 recommended
blkid Support for block device identification libblkid.so.1 required
libcrypto Support for cryptographic operations libcrypto.so.4 libcrypto.so.3 recommended
mount Support for mount enumeration libmount.so.1 required
fdisk Support for reading and writing partition tables libfdisk.so.1 required
blkid Support for block device identification libblkid.so.1 recommended
libcrypto Support for cryptographic operations libcrypto.so.4 libcrypto.so.3 suggested
cryptsetup Support for disk encryption, integrity, and authentication libcryptsetup.so.12 suggested
fdisk Support for reading and writing partition tables libfdisk.so.1 suggested
mount Support for mount enumeration libmount.so.1 recommended
selinux Support for SELinux libselinux.so.1 recommended
tpm Support for TPM libtss2-esys.so.0 suggested
tpm Support for TPM libtss2-rc.so.0 suggested
tpm Support for TPM libtss2-mu.so.0 suggested
tpm Support for TPM libtss2-tcti-device.so.0 suggested
```
# In the dlopen ELF note we save the default compression library with a
# higher priority, so that packages can give it priority over the
# secondary libraries.
-conf.set_quoted('COMPRESSION_PRIORITY_ZSTD',
+conf.set('COMPRESSION_PRIORITY_ZSTD',
compression == 'zstd' ? 'recommended' : 'suggested')
-conf.set_quoted('COMPRESSION_PRIORITY_LZ4',
+conf.set('COMPRESSION_PRIORITY_LZ4',
compression == 'lz4' ? 'recommended' : 'suggested')
-conf.set_quoted('COMPRESSION_PRIORITY_XZ',
+conf.set('COMPRESSION_PRIORITY_XZ',
compression == 'xz' ? 'recommended' : 'suggested')
conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
uint64_t b;
int r;
- r = DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended);
if (r < 0) {
*ret_badness = UINT64_MAX;
*ret_description = NULL;
info->_umask = c->umask;
#if HAVE_SECCOMP
- if (DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) >= 0) {
+ if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) >= 0) {
SET_FOREACH(key, c->syscall_archs) {
const char *name;
#include <bzlib.h>
#endif
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "bitfield.h"
#include "compress.h"
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "io-util.h"
#include "log.h"
#include "string-table.h"
#if HAVE_XZ
static void *lzma_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "lzma",
- "Support lzma compression in journal and coredump files",
- COMPRESSION_PRIORITY_XZ,
- "liblzma.so.5");
+ LIBLZMA_NOTE(COMPRESSION_PRIORITY_XZ);
return dlopen_many_sym_or_warn(
&lzma_dl,
#if HAVE_LZ4
static void *lz4_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "lz4",
- "Support lz4 compression in journal and coredump files",
- COMPRESSION_PRIORITY_LZ4,
- "liblz4.so.1");
+ LIBLZ4_NOTE(COMPRESSION_PRIORITY_LZ4);
return dlopen_many_sym_or_warn(
&lz4_dl,
#if HAVE_ZSTD
static void *zstd_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "zstd",
- "Support zstd compression in journal and coredump files",
- COMPRESSION_PRIORITY_ZSTD,
- "libzstd.so.1");
+ LIBZSTD_NOTE(COMPRESSION_PRIORITY_ZSTD);
return dlopen_many_sym_or_warn(
&zstd_dl,
#if HAVE_ZLIB
static void *zlib_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "zlib",
- "Support gzip compression and decompression",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libz.so.1");
+ LIBZ_NOTE(suggested);
return dlopen_many_sym_or_warn(
&zlib_dl,
#if HAVE_BZIP2
static void *bzip2_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "bzip2",
- "Support bzip2 compression and decompression",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libbz2.so.1");
+ LIBBZ2_NOTE(suggested);
return dlopen_many_sym_or_warn(
&bzip2_dl,
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-dlopen.h"
+
+#include "basic-forward.h"
+#include "strv.h"
+
+/* Avoid invalid priority. */
+#define _DLOPEN_CHECK_PRIORITY_required 1
+#define _DLOPEN_CHECK_PRIORITY_recommended 1
+#define _DLOPEN_CHECK_PRIORITY_suggested 1
+
+/* Unlike SD_ELF_NOTE_DLOPEN_ANCHORED(), this takes feature and priority without quotation. */
+#define ELF_NOTE_DLOPEN_ANCHORED(feature, description, priority, ...) \
+ assert_cc(_DLOPEN_CHECK_PRIORITY_##priority); \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ feature##_##priority, \
+ STRINGIFY(feature), \
+ description, \
+ STRINGIFY(priority), \
+ __VA_ARGS__)
+
+#if HAVE_BZIP2
+# define LIBBZ2_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ bzip2, \
+ "Support bzip2 compression and decompression", \
+ priority, \
+ "libbz2.so.1")
+#else
+# define LIBBZ2_NOTE(priority)
+#endif
+
+#if HAVE_LZ4
+# define LIBLZ4_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ lz4, \
+ "Support lz4 compression in journal and coredump files", \
+ priority, \
+ "liblz4.so.1")
+#else
+# define LIBLZ4_NOTE(priority)
+#endif
+
+#if HAVE_XZ
+# define LIBLZMA_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ lzma, \
+ "Support lzma compression in journal and coredump files", \
+ priority, \
+ "liblzma.so.5")
+#else
+# define LIBLZMA_NOTE(priority)
+#endif
+
+#if HAVE_ZLIB
+# define LIBZ_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ zlib, \
+ "Support gzip compression and decompression", \
+ priority, \
+ "libz.so.1")
+#else
+# define LIBZ_NOTE(priority)
+#endif
+
+#if HAVE_ZSTD
+# define LIBZSTD_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ zstd, \
+ "Support zstd compression in journal and coredump files", \
+ priority, \
+ "libzstd.so.1")
+#else
+# define LIBZSTD_NOTE(priority)
+#endif
+
+#define COMPRESS_NOTE(priority) \
+ LIBBZ2_NOTE(priority); \
+ LIBLZ4_NOTE(priority); \
+ LIBLZMA_NOTE(priority); \
+ LIBZ_NOTE(priority); \
+ LIBZSTD_NOTE(priority)
+
+#define COMPRESS_DEFAULT_NOTE \
+ LIBBZ2_NOTE(suggested); \
+ LIBLZ4_NOTE(COMPRESSION_PRIORITY_LZ4); \
+ LIBLZMA_NOTE(COMPRESSION_PRIORITY_XZ); \
+ LIBZ_NOTE(suggested); \
+ LIBZSTD_NOTE(COMPRESSION_PRIORITY_ZSTD)
if (!c->secure_boot_certificate || !c->secure_boot_private_key)
return 0;
- r = DLOPEN_LIBCRYPTO(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_DEBUG, recommended);
if (r < 0)
return r;
if (supported >= 0)
return supported;
- if (DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_BPF(LOG_WARNING, recommended) < 0)
return (supported = false);
obj = bind_iface_bpf__open();
if (!initialize)
return false;
- if (DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_BPF(LOG_WARNING, recommended) < 0)
return (supported = false);
r = lsm_supported("bpf");
if (supported >= 0)
return supported;
- if (DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_BPF(LOG_WARNING, recommended) < 0)
return (supported = false);
r = lsm_supported("bpf");
assert(m);
- r = DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_BPF(LOG_WARNING, recommended);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
"bpf-restrict-fsaccess: Failed to load libbpf for FD validation, aborting.");
if (supported >= 0)
return supported;
- if (DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_BPF(LOG_WARNING, recommended) < 0)
return (supported = false);
r = prepare_restrict_ifaces_bpf(NULL, true, NULL, &obj);
_cleanup_(socket_bind_bpf_freep) struct socket_bind_bpf *obj = NULL;
int r;
- if (DLOPEN_BPF(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_BPF(LOG_WARNING, recommended) < 0)
return false;
r = prepare_socket_bind_bpf(/* unit= */ NULL, /* allow_rules= */ NULL, /* deny_rules= */ NULL, &obj);
* 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, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBPAM(LOG_ERR, recommended);
if (r < 0)
return r;
assert(c);
/* No libseccomp, all is fine */
- if (DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) < 0)
return true;
/* No syscall filter, we are allowed to drop privileges */
}
/* We are in a new binary, so dl-open again */
- r = DLOPEN_BPF(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_BPF(LOG_DEBUG, recommended);
if (r < 0)
return r;
}
/* Load a bunch of libraries we'll possibly need later, before we turn off dlopen() */
- (void) DLOPEN_BPF(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ (void) DLOPEN_BPF(LOG_DEBUG, recommended);
+ (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended);
/* Needed for userspace verity verification fallback */
- (void) DLOPEN_LIBCRYPTO(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ (void) DLOPEN_LIBCRYPTO(LOG_DEBUG, recommended);
/* 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 */
fputc('~', f);
#if HAVE_SECCOMP
- if (DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) >= 0) {
+ if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) >= 0) {
void *id, *val;
bool first = true;
HASHMAP_FOREACH_KEY(val, id, c->syscall_filter) {
assert(c);
#if HAVE_SECCOMP
- if (DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) < 0)
return strv_new(NULL);
void *id, *val;
assert(c);
#if HAVE_SECCOMP
- if (DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) < 0)
+ if (DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended) < 0)
return strv_new(NULL);
void *id, *val;
}
/* Building without libmount is allowed, but if it is compiled in, then we must be able to load it */
- r = DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBMOUNT(LOG_DEBUG, required);
if (r < 0 && !ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
error_message = "Failed to load libmount.so";
goto finish;
}
static bool mount_supported(void) {
- return DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) >= 0;
+ return DLOPEN_LIBMOUNT(LOG_DEBUG, recommended) >= 0;
}
static int mount_subsystem_ratelimited(Manager *m) {
if (r > 0)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Target namespace is not separate, cannot reload extensions");
- (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
extension_dir = path_join(p->private_namespace_dir, "unit-extensions");
if (!extension_dir)
assert(loaded_policy);
- r = DLOPEN_LIBSELINUX(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBSELINUX(LOG_DEBUG, recommended);
if (r < 0)
return 0;
_cleanup_(mnt_free_tablep) struct libmnt_table *table = NULL;
int r;
- r = DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBMOUNT(LOG_DEBUG, recommended);
if (r < 0)
return r;
if (FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
c.link = sd_varlink_ref(link);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
if (strdup_to(&c.node, node) < 0)
return -ENOMEM;
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
if (r < 0)
return r;
assert(pin || pin_size == 0);
assert(token >= 0);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
assert(json);
- if (DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED) < 0)
+ if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
return;
r = parse_luks2_fido2_data(cd, json, &rp_id, &salt, &salt_size, &cid, &cid_size, &required);
assert(json);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
assert(pin || pin_size == 0);
assert(token >= 0);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
_cleanup_free_ void *pkcs11_key = NULL;
Pkcs11RsaPadding rsa_padding = PKCS11_RSA_PADDING_PKCS1V15;
- if (DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED) < 0)
+ if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
return;
r = parse_luks2_pkcs11_data(cd, json, &pkcs11_uri, &pkcs11_key, &pkcs11_key_size, &rsa_padding);
sd_json_variant *w;
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
assert(ret_password);
assert(ret_password_len);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
assert(json);
- if (DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED) < 0)
+ if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
return;
r = sd_json_parse(json, SD_JSON_PARSE_MUST_BE_OBJECT, &v, /* reterr_line= */ NULL, /* reterr_column= */ NULL);
assert(json);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
#if HAVE_OPENSSL
_cleanup_strv_free_ char **l = NULL;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
if (r < 0)
return r;
break;
OPTION_LONG("make-archive", NULL, "Convert the DDI to an archive file"):
- r = DLOPEN_LIBARCHIVE(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBARCHIVE(LOG_ERR, recommended);
if (r < 0)
return r;
uint64_t size;
int r;
- r = DLOPEN_CRYPTSETUP(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_WARNING, recommended);
if (r < 0)
return r;
/* Let's decode the PEM key to DER (so that we lose prefix/suffix), then truncate it
* for display reasons. */
- r = DLOPEN_LIBCRYPTO(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(m);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
assert(encrypted_size > 0);
assert(match_key_descriptor);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
assert(iovec_is_set(tag));
assert(match_key_descriptor);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
size_t encrypted_size;
ssize_t ss;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
assert(setup);
assert(ret_home);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
assert(ret_fstype);
assert(ret_uuid);
- r = DLOPEN_LIBBLKID(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBBLKID(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(setup);
assert(!setup->crypt_device);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(ret_size);
assert(sector_size > 0);
- r = DLOPEN_LIBBLKID(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBBLKID(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(cd);
assert(ret);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
assert(setup);
assert(user_record_storage(h) == USER_LUKS);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(setup);
assert(ret_home);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(setup->image_fd < 0);
assert(ret_home);
- r = DLOPEN_FDISK(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_FDISK(LOG_DEBUG, recommended);
if (r < 0)
return r;
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(user_record_storage(h) == USER_LUKS);
assert(setup);
- r = DLOPEN_FDISK(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_FDISK(LOG_DEBUG, recommended);
if (r < 0)
return r;
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(user_record_storage(h) == USER_LUKS);
assert(setup);
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return r;
if (r < 0)
log_warning_errno(r, "Failed to determine if %s is encrypted, ignoring: %m", get_home_root());
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
log_info("Not using '%s' storage, since libcryptsetup could not be loaded.", user_storage_to_string(USER_LUKS));
else {
bool debug = false;
int r;
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
bool debug = false;
int r;
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
bool debug = false;
int r;
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
usec_t t;
int r;
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
bool debug = false;
int r;
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
if (r <= 0)
return r;
- r = DLOPEN_CURL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CURL(LOG_DEBUG, required);
if (r < 0)
return r;
assert(tree_fd >= 0);
assert(ret_pid);
- r = DLOPEN_LIBARCHIVE(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBARCHIVE(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(tree_fd >= 0);
assert(ret_pid);
- r = DLOPEN_LIBARCHIVE(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBARCHIVE(LOG_DEBUG, recommended);
if (r < 0)
return r;
}
if (j->calc_checksum) {
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
log_setup();
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_MICROHTTPD(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_MICROHTTPD(LOG_ERR, required);
if (r < 0)
return r;
#if HAVE_MICROHTTPD
int r;
- r = DLOPEN_MICROHTTPD(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_MICROHTTPD(LOG_ERR, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_CURL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CURL(LOG_DEBUG, required);
if (r < 0)
return r;
assert(arg_action == ACTION_SETUP_KEYS);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
return r;
}
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "log.h"
#include "string-util.h"
#include "xkbcommon-util.h"
static int dlopen_xkbcommon(int log_level) {
static void *xkbcommon_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "xkbcommon",
- "Support for keyboard locale descriptions",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED, "libxkbcommon.so.0");
+ LIBXKBCOMMON_NOTE(suggested);
return dlopen_many_sym_or_warn(
&xkbcommon_dl, "libxkbcommon.so.0", log_level,
assert(pamh);
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
assert(pamh);
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
assert(pamh);
- r = DLOPEN_LIBPAM(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBPAM(LOG_DEBUG, required);
if (r < 0)
return PAM_SERVICE_ERR;
"Select TPM bank (SHA1, SHA256, SHA384, SHA512)"): {
const EVP_MD *implementation;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
assert(manager);
- r = DLOPEN_BPF(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_BPF(LOG_DEBUG, recommended);
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
return log_debug_errno(r, "sysctl monitor disabled, as BPF support is not available.");
if (r < 0)
if (r < 0)
return json_log(def, flags, r, "Unknown default action: %s", sd_json_variant_string(def));
- r = DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended);
if (r < 0)
return json_log(def, flags, r, "No support for libseccomp: %m");
if (arg_cleanup)
return do_cleanup();
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBSECCOMP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBSELINUX(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBSECCOMP(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBSELINUX(LOG_DEBUG, recommended);
r = cg_has_legacy();
if (r < 0)
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "bpf-lsm not supported, can't lock down user namespace.");
- r = DLOPEN_BPF(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_BPF(LOG_DEBUG, recommended);
if (r < 0)
return r;
OPTION_LONG("bank", "DIGEST", "Select TPM PCR bank (SHA1, SHA256)"): {
const EVP_MD *implementation;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
* there, and extract the metadata we need. The metadata is sent from the child back to us. */
/* Load some libraries before we fork workers off that want to use them */
- (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, required);
r = mkdtemp_malloc("/tmp/inspect-XXXXXX", &tmpdir);
if (r < 0)
"Cannot format %s filesystem without source files, refusing.", p->format);
if (p->verity != VERITY_OFF || p->encrypt != ENCRYPT_OFF) {
- r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
if (r < 0)
return log_syntax(NULL, LOG_ERR, path, 1, r,
"libcryptsetup not found, Verity=/Encrypt= are not supported: %m");
assert(offset != UINT64_MAX);
assert(size != UINT64_MAX);
- r = DLOPEN_LIBBLKID(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBBLKID(LOG_ERR, required);
if (r < 0)
return r;
assert(p);
assert(p->encrypt != ENCRYPT_OFF);
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, recommended);
if (r < 0)
return r;
(void) partition_hint(p, node, &hint);
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, recommended);
if (r < 0)
return r;
assert(iovec_is_set(roothash));
assert(ret_signature);
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
if (r < 0)
return r;
* appear in the host namespace. Hence we fork a child that has its own file system namespace and
* detached mount propagation. */
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, required);
r = pidref_safe_fork(
"(sd-copy)",
return log_error_errno(r, "Failed to open block device " DEVNUM_FORMAT_STR ": %m",
DEVNUM_FORMAT_VAL(whole_devno));
- r = DLOPEN_LIBBLKID(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBBLKID(LOG_ERR, required);
if (r < 0)
return r;
if (r <= 0)
return r;
- r = DLOPEN_FDISK(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_FDISK(LOG_ERR, required);
if (r < 0)
return r;
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
int r;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
char error[CURL_ERROR_SIZE] = {};
int r;
- r = DLOPEN_CURL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CURL(LOG_DEBUG, required);
if (r < 0)
return r;
assert(dnskey);
assert(result);
- r = DLOPEN_LIBCRYPTO(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_WARNING, recommended);
if (r < 0)
return r;
assert(dnskey);
assert(ds);
- r = DLOPEN_LIBCRYPTO(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_WARNING, recommended);
if (r < 0)
return r;
assert(name);
assert(ret);
- r = DLOPEN_LIBCRYPTO(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_WARNING, recommended);
if (r < 0)
return r;
if (manager->dnstls_data.ctx)
return 0;
- r = DLOPEN_LIBCRYPTO(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBCRYPTO(LOG_WARNING, recommended);
if (r < 0)
return r;
- r = DLOPEN_LIBSSL(LOG_WARNING, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBSSL(LOG_WARNING, recommended);
if (r < 0)
return r;
#if HAVE_LIBIDN2
_cleanup_free_ char *utf8 = NULL;
- if (DLOPEN_IDN(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED) >= 0) {
+ if (DLOPEN_IDN(LOG_DEBUG, recommended) >= 0) {
r = sym_idn2_to_unicode_8z8z(label, &utf8, 0);
if (r != IDN2_OK)
return log_debug_errno(SYNTHETIC_ERRNO(EUCLEAN),
_cleanup_(iovec_done) struct iovec signed_attributes_signature = {};
int r;
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
#include <sys/stat.h>
#include <sys/syslog.h>
-#include "sd-dlopen.h"
-
#include "acl-util.h"
#include "alloc-util.h"
#include "errno-util.h"
#if HAVE_ACL
static void *libacl_dl = NULL;
- LIBACL_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBACL_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libacl_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_ACL
return (b ? sym_acl_add_perm : sym_acl_delete_perm)(ps, p);
}
-#define LIBACL_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("acl", \
- "Support for file Access Control Lists (ACLs)", \
- priority, \
- "libacl.so.1")
-
-#define DLOPEN_LIBACL(log_level, priority) \
- ({ \
- LIBACL_NOTE(priority); \
- dlopen_libacl(log_level); \
- })
#else
typedef void* acl_t;
static inline int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask) {
return -EOPNOTSUPP;
}
-
-#define DLOPEN_LIBACL(log_level, priority) dlopen_libacl(log_level)
#endif
int dlopen_libacl(int log_level);
+#define DLOPEN_LIBACL(log_level, priority) \
+ ({ \
+ LIBACL_NOTE(priority); \
+ dlopen_libacl(log_level); \
+ })
+
int fd_acl_make_read_only(int fd);
int fd_acl_make_writable(int fd);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "apparmor-util.h"
+#include "dlopen-note.h"
#include "log.h"
#if HAVE_APPARMOR
#include <syslog.h>
-#include "sd-dlopen.h"
-
#include "fileio.h"
DLSYM_PROTOTYPE(aa_change_onexec) = NULL;
#if HAVE_APPARMOR
static void *libapparmor_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "apparmor",
- "Support for AppArmor policies",
- SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
- "libapparmor.so.1");
+ LIBAPPARMOR_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libapparmor_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
#include "sd-id128.h"
#include "blkid-util.h"
#if HAVE_BLKID
static void *libblkid_dl = NULL;
- LIBBLKID_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBBLKID_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libblkid_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_BLKID
int blkid_probe_lookup_value_id128(blkid_probe b, const char *field, sd_id128_t *ret);
int blkid_probe_lookup_value_u64(blkid_probe b, const char *field, uint64_t *ret);
+#endif
-#define LIBBLKID_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("blkid", \
- "Support for block device identification", \
- priority, \
- "libblkid.so.1")
+int dlopen_libblkid(int log_level);
#define DLOPEN_LIBBLKID(log_level, priority) \
({ \
LIBBLKID_NOTE(priority); \
dlopen_libblkid(log_level); \
})
-#else
-#define DLOPEN_LIBBLKID(log_level, priority) dlopen_libblkid(log_level)
-#endif
-
-int dlopen_libblkid(int log_level);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "bpf-util.h"
#include "dlfcn-util.h"
#include "initrd-util.h"
if (cached < 0)
return cached; /* Already tried, and failed. */
- BPF_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBBPF_NOTE(suggested);
DISABLE_WARNING_DEPRECATED_DECLARATIONS;
#include <syslog.h>
-#include "sd-dlopen.h"
+#include "dlopen-note.h"
+#include "shared-forward.h"
#if HAVE_LIBBPF
#ifndef SYSTEMD_CFLAGS_MARKER_LIBBPF
#include <bpf/libbpf.h> /* IWYU pragma: export */
#include "dlfcn-util.h"
-#include "shared-forward.h"
/* Always redeclare these so DLSYM_PROTOTYPE's typeof() resolves regardless of libbpf version;
* suppress the warning when the libbpf headers already declare them.
* this helper instead of libbpf_get_error() to ensure some of the known ones are translated into errnos
* we understand. */
int bpf_get_error_translated(const void *ptr);
+#endif
-#define BPF_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("bpf", \
- "Support firewalling and sandboxing with BPF", \
- priority, \
- "libbpf.so.1", "libbpf.so.0")
+int dlopen_bpf(int log_level);
#define DLOPEN_BPF(log_level, priority) \
({ \
- BPF_NOTE(priority); \
+ LIBBPF_NOTE(priority); \
dlopen_bpf(log_level); \
})
-#else
-#define DLOPEN_BPF(log_level, priority) dlopen_bpf(log_level)
-#endif
-
-int dlopen_bpf(int log_level);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "ask-password-api.h"
#include "crypto-util.h"
static void *libcrypto_dl = NULL;
int r;
- LIBCRYPTO_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBCRYPTO_NOTE(suggested);
FOREACH_STRING(soname, "libcrypto.so.4", "libcrypto.so.3") {
r = dlopen_many_sym_or_warn(
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
-#include "shared-forward.h"
+#include "dlopen-note.h"
#include "iovec-util.h"
#include "sha256.h"
+#include "shared-forward.h"
typedef enum CertificateSourceType {
OPENSSL_CERTIFICATE_SOURCE_FILE,
int parse_openssl_key_source_argument(const char *argument, char **private_key_source, KeySourceType *private_key_source_type);
-int dlopen_libcrypto(int log_level);
-
#define X509_FINGERPRINT_SIZE SHA256_DIGEST_SIZE
#if HAVE_OPENSSL
# error "missing libopenssl_cflags in meson dependency."
#endif
-#define LIBCRYPTO_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("libcrypto", \
- "Support for cryptographic operations", \
- priority, \
- "libcrypto.so.4", "libcrypto.so.3")
-
-#define DLOPEN_LIBCRYPTO(log_level, priority) \
- ({ \
- LIBCRYPTO_NOTE(priority); \
- dlopen_libcrypto(log_level); \
- })
-
# include <openssl/bio.h> /* IWYU pragma: export */
# include <openssl/bn.h> /* IWYU pragma: export */
# include <openssl/core_names.h> /* IWYU pragma: export */
OpenSSLAskPasswordUI* openssl_ask_password_ui_free(OpenSSLAskPasswordUI *ui);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(OpenSSLAskPasswordUI*, openssl_ask_password_ui_free, NULL);
-
-#else
-#define DLOPEN_LIBCRYPTO(log_level, priority) dlopen_libcrypto(log_level)
#endif
+
+int dlopen_libcrypto(int log_level);
+
+#define DLOPEN_LIBCRYPTO(log_level, priority) \
+ ({ \
+ LIBCRYPTO_NOTE(priority); \
+ dlopen_libcrypto(log_level); \
+ })
#include <stdlib.h>
-#include "sd-dlopen.h"
#include "sd-json.h"
#include "alloc-util.h"
* still available though, and given we want to support 2.2.0 for a while longer, we'll use the old
* symbol if the new one is not available. */
- CRYPTSETUP_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBCRYPTSETUP_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&cryptsetup_dl, "libcryptsetup.so.12", log_level,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBCRYPTSETUP
int cryptsetup_get_volume_key_prefix(struct crypt_device *cd, const char *volume_name, char **ret);
int cryptsetup_get_volume_key_id(struct crypt_device *cd, const char *volume_name, const void *volume_key,
size_t volume_key_size, char **ret);
+#endif
-#define CRYPTSETUP_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("cryptsetup", \
- "Support for disk encryption, integrity, and authentication", \
- priority, \
- "libcryptsetup.so.12")
+int dlopen_cryptsetup(int log_level);
#define DLOPEN_CRYPTSETUP(log_level, priority) \
({ \
- CRYPTSETUP_NOTE(priority); \
+ LIBCRYPTSETUP_NOTE(priority); \
dlopen_cryptsetup(log_level); \
})
-#else
-#define DLOPEN_CRYPTSETUP(log_level, priority) dlopen_cryptsetup(log_level)
-#endif
-
-int dlopen_cryptsetup(int log_level);
int cryptsetup_get_keyslot_from_token(sd_json_variant *v);
#if HAVE_LIBCURL
-#include "sd-dlopen.h"
#include "sd-event.h"
#include "alloc-util.h"
#if HAVE_LIBCURL
static void *curl_dl = NULL;
- CURL_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBCURL_NOTE(suggested);
return dlopen_many_sym_or_warn(
&curl_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBCURL
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(CURL*, sym_curl_easy_cleanup, curl_easy_cleanupp, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct curl_slist*, sym_curl_slist_free_all, curl_slist_free_allp, NULL);
+#endif
-#define CURL_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("curl", \
- "Support for downloading and uploading files over HTTP", \
- priority, \
- "libcurl.so.4")
+int dlopen_curl(int log_level);
#define DLOPEN_CURL(log_level, priority) \
({ \
- CURL_NOTE(priority); \
+ LIBCURL_NOTE(priority); \
dlopen_curl(log_level); \
})
-#else
-#define DLOPEN_CURL(log_level, priority) dlopen_curl(log_level)
-#endif
-
-int dlopen_curl(int log_level);
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "../basic/dlopen-note.h" /* IWYU pragma: export */
+#include "shared-forward.h"
+
+#if HAVE_ACL
+# define LIBACL_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ acl, \
+ "Support for file Access Control Lists (ACLs)", \
+ priority, \
+ "libacl.so.1")
+#else
+# define LIBACL_NOTE(priority)
+#endif
+
+#if HAVE_APPARMOR
+# define LIBAPPARMOR_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ apparmor, \
+ "Support for AppArmor policies", \
+ priority, \
+ "libapparmor.so.1")
+#else
+# define LIBAPPARMOR_NOTE(priority)
+#endif
+
+#if HAVE_LIBARCHIVE
+# define LIBARCHIVE_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ archive, \
+ "Support for decompressing archive files", \
+ priority, \
+ "libarchive.so.13")
+#else
+# define LIBARCHIVE_NOTE(priority)
+#endif
+
+#if HAVE_AUDIT
+# define LIBAUDIT_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ audit, \
+ "Support for Audit logging", \
+ priority, \
+ "libaudit.so.1")
+#else
+# define LIBAUDIT_NOTE(priority)
+#endif
+
+#if HAVE_BLKID
+# define LIBBLKID_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ blkid, \
+ "Support for block device identification", \
+ priority, \
+ "libblkid.so.1")
+#else
+# define LIBBLKID_NOTE(priority)
+#endif
+
+#if HAVE_LIBBPF
+# define LIBBPF_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ bpf, \
+ "Support firewalling and sandboxing with BPF", \
+ priority, \
+ "libbpf.so.1", "libbpf.so.0")
+#else
+# define LIBBPF_NOTE(priority)
+#endif
+
+#if HAVE_LIBCRYPT && defined(__GLIBC__)
+# define LIBCRYPT_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ crypt, \
+ "Support for hashing passwords", \
+ priority, \
+ "libcrypt.so.2", "libcrypt.so.1", "libcrypt.so.1.1")
+#else
+# define LIBCRYPT_NOTE(priority)
+#endif
+
+#if HAVE_OPENSSL
+# define LIBCRYPTO_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ libcrypto, \
+ "Support for cryptographic operations", \
+ priority, \
+ "libcrypto.so.4", "libcrypto.so.3")
+#else
+# define LIBCRYPTO_NOTE(priority)
+#endif
+
+#if HAVE_LIBCRYPTSETUP
+# define LIBCRYPTSETUP_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ cryptsetup, \
+ "Support for disk encryption, integrity, and authentication", \
+ priority, \
+ "libcryptsetup.so.12")
+#else
+# define LIBCRYPTSETUP_NOTE(priority)
+#endif
+
+#if HAVE_LIBCURL
+# define LIBCURL_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ curl, \
+ "Support for downloading and uploading files over HTTP", \
+ priority, \
+ "libcurl.so.4")
+#else
+# define LIBCURL_NOTE(priority)
+#endif
+
+#if HAVE_LIBFDISK
+# define LIBFDISK_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ fdisk, \
+ "Support for reading and writing partition tables", \
+ priority, \
+ "libfdisk.so.1")
+#else
+# define LIBFDISK_NOTE(priority)
+#endif
+
+#if HAVE_ELFUTILS
+# define LIBDW_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ dw, \
+ "Support for backtrace and ELF package metadata decoding from core files", \
+ priority, \
+ "libdw.so.1")
+#else
+# define LIBDW_NOTE(priority)
+#endif
+
+#if HAVE_ELFUTILS
+# define LIBELF_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ elf, \
+ "Support for backtraces and reading ELF package metadata from core files", \
+ priority, \
+ "libelf.so.1")
+#else
+# define LIBELF_NOTE(priority)
+#endif
+
+#if HAVE_LIBFIDO2
+# define LIBFIDO2_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ fido2, \
+ "Support fido2 for encryption and authentication", \
+ priority, \
+ "libfido2.so.1")
+#else
+# define LIBFIDO2_NOTE(priority)
+#endif
+
+#if HAVE_GNUTLS
+# define LIBGNUTLS_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ gnutls, \
+ "Support for TLS via GnuTLS", \
+ priority, \
+ "libgnutls.so.30")
+#else
+# define LIBGNUTLS_NOTE(priority)
+#endif
+
+#if HAVE_LIBIDN2
+# define LIBIDN2_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ idn, \
+ "Support for internationalized domain names", \
+ priority, \
+ "libidn2.so.0")
+#else
+# define LIBIDN2_NOTE(priority)
+#endif
+
+#if HAVE_KMOD
+# define LIBKMOD_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ kmod, \
+ "Support for loading kernel modules", \
+ priority, \
+ "libkmod.so.2")
+#else
+# define LIBKMOD_NOTE(priority)
+#endif
+
+#if HAVE_MICROHTTPD
+# define LIBMICROHTTPD_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ microhttpd, \
+ "Support for embedded HTTP server via libmicrohttpd", \
+ priority, \
+ "libmicrohttpd.so.12")
+#else
+# define LIBMICROHTTPD_NOTE(priority)
+#endif
+
+#if HAVE_LIBMOUNT
+# define LIBMOUNT_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ mount, \
+ "Support for mount enumeration", \
+ priority, \
+ "libmount.so.1")
+#else
+# define LIBMOUNT_NOTE(priority)
+#endif
+
+#if HAVE_P11KIT
+# define LIBP11KIT_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ p11kit_##priority, \
+ "p11-kit", \
+ "Support for PKCS11 hardware tokens", \
+ STRINGIFY(priority), \
+ "libp11-kit.so.0")
+#else
+# define LIBP11KIT_NOTE(priority)
+#endif
+
+#if HAVE_PAM
+# define LIBPAM_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ pam, \
+ "Support for LinuxPAM", \
+ priority, \
+ "libpam.so.0")
+#else
+# define LIBPAM_NOTE(priority)
+#endif
+
+#if HAVE_PASSWDQC
+# define LIBPASSWDQC_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ passwdqc, \
+ "Support for password quality checks", \
+ priority, \
+ "libpasswdqc.so.1")
+#else
+# define LIBPASSWDQC_NOTE(priority)
+#endif
+
+#if HAVE_PCRE2
+# define LIBPCRE2_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ pcre2, \
+ "Support for regular expressions", \
+ priority, \
+ "libpcre2-8.so.0")
+#else
+# define LIBPCRE2_NOTE(priority)
+#endif
+
+#if HAVE_PWQUALITY
+# define LIBPWQUALITY_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ pwquality, \
+ "Support for password quality checks", \
+ priority, \
+ "libpwquality.so.1")
+#else
+# define LIBPWQUALITY_NOTE(priority)
+#endif
+
+#if HAVE_QRENCODE
+# define LIBQRENCODE_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ qrencode, \
+ "Support for generating QR codes", \
+ priority, \
+ "libqrencode.so.4", "libqrencode.so.3")
+#else
+# define LIBQRENCODE_NOTE(priority)
+#endif
+
+#if HAVE_SECCOMP
+# define LIBSECCOMP_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ seccomp, \
+ "Support for Seccomp Sandboxes", \
+ priority, \
+ "libseccomp.so.2")
+#else
+# define LIBSECCOMP_NOTE(priority)
+#endif
+
+#if HAVE_SELINUX
+# define LIBSELINUX_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ selinux, \
+ "Support for SELinux", \
+ priority, \
+ "libselinux.so.1")
+#else
+# define LIBSELINUX_NOTE(priority)
+#endif
+
+#if HAVE_OPENSSL
+# define LIBSSL_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ libssl, \
+ "Support for TLS", \
+ priority, \
+ "libssl.so.4", "libssl.so.3")
+#else
+# define LIBSSL_NOTE(priority)
+#endif
+
+#if HAVE_TPM2
+# define LIBTSS2_ESYS_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ tpm2_esys_##priority, \
+ "tpm", \
+ "Support for TPM", \
+ STRINGIFY(priority), \
+ "libtss2-esys.so.0")
+# define LIBTSS2_RC_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ tpm2_rc_##priority, \
+ "tpm", \
+ "Support for TPM", \
+ STRINGIFY(priority), \
+ "libtss2-rc.so.0")
+# define LIBTSS2_MU_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ tpm2_mu_##priority, \
+ "tpm", \
+ "Support for TPM", \
+ STRINGIFY(priority), \
+ "libtss2-mu.so.0")
+# define LIBTSS2_TCTI_DEVICE_NOTE(priority) \
+ SD_ELF_NOTE_DLOPEN_ANCHORED( \
+ tpm2_tcti_device_##priority, \
+ "tpm", \
+ "Support for TPM", \
+ STRINGIFY(priority), \
+ "libtss2-tcti-device.so.0")
+#else
+# define LIBTSS2_ESYS_NOTE(priority)
+# define LIBTSS2_RC_NOTE(priority)
+# define LIBTSS2_MU_NOTE(priority)
+# define LIBTSS2_TCTI_DEVICE_NOTE(priority)
+#endif
+
+#if HAVE_XKBCOMMON
+# define LIBXKBCOMMON_NOTE(priority) \
+ ELF_NOTE_DLOPEN_ANCHORED( \
+ xkbcommon, \
+ "Support for keyboard locale descriptions", \
+ priority, \
+ "libxkbcommon.so.0")
+#else
+# define LIBXKBCOMMON_NOTE(priority)
+#endif
+
+#if HAVE_LIBARCHIVE
+# define ARCHIVE_NOTE(priority) \
+ COMPRESS_NOTE(priority); \
+ LIBACL_NOTE(priority); \
+ LIBARCHIVE_NOTE(priority)
+#else
+# define ARCHIVE_NOTE(priority) \
+ COMPRESS_NOTE(priority)
+#endif
+
+#define PASSWORD_NOTE(priority) \
+ LIBPASSWDQC_NOTE(priority); \
+ LIBPWQUALITY_NOTE(priority)
+
+#define TPM2_NOTE(priority) \
+ LIBTSS2_ESYS_NOTE(priority); \
+ LIBTSS2_RC_NOTE(priority); \
+ LIBTSS2_MU_NOTE(priority); \
+ LIBTSS2_TCTI_DEVICE_NOTE(priority)
#endif
#include <unistd.h>
-#include "sd-dlopen.h"
#include "sd-json.h"
#include "alloc-util.h"
#include "coredump-util.h"
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "elf-util.h"
#include "errno-util.h"
#include "escape.h"
static void *dw_dl = NULL;
int r;
- SD_ELF_NOTE_DLOPEN(
- "dw",
- "Support for backtrace and ELF package metadata decoding from core files",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libdw.so.1");
+ LIBDW_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&dw_dl, "libdw.so.1", log_level,
static void *elf_dl = NULL;
int r;
- SD_ELF_NOTE_DLOPEN(
- "elf",
- "Support for backtraces and reading ELF package metadata from core files",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libelf.so.1");
+ LIBELF_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&elf_dl, "libelf.so.1", log_level,
#if HAVE_LIBFDISK
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "bitfield.h"
#include "dissect-image.h"
#if HAVE_LIBFDISK
static void *fdisk_dl = NULL;
- FDISK_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBFDISK_NOTE(suggested);
return dlopen_many_sym_or_warn(
&fdisk_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBFDISK
int fdisk_partition_get_attrs_as_uint64(struct fdisk_partition *pa, uint64_t *ret);
int fdisk_partition_set_attrs_as_uint64(struct fdisk_partition *pa, uint64_t flags);
+#endif
-#define FDISK_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("fdisk", \
- "Support for reading and writing partition tables", \
- priority, \
- "libfdisk.so.1")
+int dlopen_fdisk(int log_level);
#define DLOPEN_FDISK(log_level, priority) \
({ \
- FDISK_NOTE(priority); \
+ LIBFDISK_NOTE(priority); \
dlopen_fdisk(log_level); \
})
-#else
-#define DLOPEN_FDISK(log_level, priority) dlopen_fdisk(log_level)
-#endif
-
-int dlopen_fdisk(int log_level);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "gnutls-util.h"
#include "log.h" /* IWYU pragma: keep */
#if HAVE_GNUTLS
static void *gnutls_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "gnutls",
- "Support for TLS via GnuTLS",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libgnutls.so.30");
+ LIBGNUTLS_NOTE(suggested);
return dlopen_many_sym_or_warn(
&gnutls_dl,
#if HAVE_LIBIDN2
-#include "sd-dlopen.h"
-
static void* idn_dl = NULL;
DLSYM_PROTOTYPE(idn2_lookup_u8) = NULL;
int dlopen_idn(int log_level) {
#if HAVE_LIBIDN2
- IDN_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBIDN2_NOTE(suggested);
return dlopen_many_sym_or_warn(
&idn_dl, "libidn2.so.0", log_level,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBIDN2
extern DLSYM_PROTOTYPE(idn2_lookup_u8);
extern const char *(*sym_idn2_strerror)(int rc) _const_;
extern DLSYM_PROTOTYPE(idn2_to_unicode_8z8z);
+#endif
-#define IDN_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("idn", \
- "Support for internationalized domain names", \
- priority, \
- "libidn2.so.0")
+int dlopen_idn(int log_level);
#define DLOPEN_IDN(log_level, priority) \
({ \
- IDN_NOTE(priority); \
+ LIBIDN2_NOTE(priority); \
dlopen_idn(log_level); \
})
-#else
-#define DLOPEN_IDN(log_level, priority) dlopen_idn(log_level)
-#endif
-
-int dlopen_idn(int log_level);
#include <syslog.h>
-#include "sd-dlopen.h"
-
#include "libarchive-util.h"
#include "log.h" /* IWYU pragma: keep */
#include "user-util.h" /* IWYU pragma: keep */
static void *libarchive_dl = NULL;
int r;
- LIBARCHIVE_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBARCHIVE_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&libarchive_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBARCHIVE
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct archive_entry*, sym_archive_entry_free, archive_entry_freep, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct archive*, sym_archive_write_free, archive_write_freep, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct archive*, sym_archive_read_free, archive_read_freep, NULL);
+#endif
-#define LIBARCHIVE_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("archive", \
- "Support for decompressing archive files", \
- priority, \
- "libarchive.so.13")
+int dlopen_libarchive(int log_level);
#define DLOPEN_LIBARCHIVE(log_level, priority) \
({ \
LIBARCHIVE_NOTE(priority); \
dlopen_libarchive(log_level); \
})
-
-#else
-#define DLOPEN_LIBARCHIVE(log_level, priority) dlopen_libarchive(log_level)
-#endif
-
-int dlopen_libarchive(int log_level);
#include <linux/netlink.h>
#include <sys/socket.h>
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "errno-util.h"
#include "fd-util.h"
#include "iovec-util.h"
#if HAVE_AUDIT
static void *libaudit_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "audit",
- "Support for Audit logging",
- SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
- "libaudit.so.1");
+ LIBAUDIT_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libaudit_dl,
# include <crypt.h>
#endif
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "errno-util.h"
#include "libcrypt-util.h"
#include "log.h"
if (cached < 0)
return cached; /* Already tried, and failed. */
+ LIBCRYPT_NOTE(recommended);
+
/* Several distributions like Debian/Ubuntu and OpenSUSE provide libxcrypt as libcrypt.so.1
* (libcrypt.so.1.1 on some architectures), while others like Fedora/CentOS and Arch provide it as
* libcrypt.so.2. */
- SD_ELF_NOTE_DLOPEN(
- "crypt",
- "Support for hashing passwords",
- SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
- "libcrypt.so.2", "libcrypt.so.1", "libcrypt.so.1.1");
-
FOREACH_STRING(soname, "libcrypt.so.2", "libcrypt.so.1", "libcrypt.so.1.1") {
r = dlopen_many_sym_or_warn(
&libcrypt_dl, soname, LOG_DEBUG,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "libfido2-util.h"
#include "log.h"
static void *libfido2_dl = NULL;
int r;
- SD_ELF_NOTE_DLOPEN(
- "fido2",
- "Support fido2 for encryption and authentication",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libfido2.so.1");
+ LIBFIDO2_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&libfido2_dl, "libfido2.so.1", log_level,
#include <stdio.h>
-#include "sd-dlopen.h"
-
#include "fstab-util.h"
DLSYM_PROTOTYPE(mnt_free_iter) = NULL;
#if HAVE_LIBMOUNT
static void *libmount_dl = NULL;
- LIBMOUNT_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBMOUNT_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libmount_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBMOUNT
struct libmnt_table *table,
struct libmnt_fs *fs);
-#define LIBMOUNT_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("mount", \
- "Support for mount enumeration", \
- priority, \
- "libmount.so.1")
-
-#define DLOPEN_LIBMOUNT(log_level, priority) \
- ({ \
- LIBMOUNT_NOTE(priority); \
- dlopen_libmount(log_level); \
- })
#else
struct libmnt_monitor;
-
static inline void* sym_mnt_unref_monitor(struct libmnt_monitor *p) {
assert(p == NULL);
return NULL;
}
-#define DLOPEN_LIBMOUNT(log_level, priority) dlopen_libmount(log_level)
#endif
int dlopen_libmount(int log_level);
+
+#define DLOPEN_LIBMOUNT(log_level, priority) \
+ ({ \
+ LIBMOUNT_NOTE(priority); \
+ dlopen_libmount(log_level); \
+ })
#include <stdio.h>
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "gnutls-util.h"
#include "log.h"
#if HAVE_MICROHTTPD
static void *microhttpd_dl = NULL;
- MICROHTTPD_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBMICROHTTPD_NOTE(suggested);
return dlopen_many_sym_or_warn(
µhttpd_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
-int dlopen_microhttpd(int log_level);
-
#if HAVE_MICROHTTPD
#ifndef SYSTEMD_CFLAGS_MARKER_LIBMICROHTTPD
# error "missing libmicrohttpd_cflags in meson dependency."
#endif
-#define MICROHTTPD_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("microhttpd", \
- "Support for embedded HTTP server via libmicrohttpd", \
- priority, \
- "libmicrohttpd.so.12")
-
-#define DLOPEN_MICROHTTPD(log_level, priority) \
- ({ \
- MICROHTTPD_NOTE(priority); \
- dlopen_microhttpd(log_level); \
- })
-
#include <microhttpd.h>
#include "dlfcn-util.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct MHD_Daemon*, sym_MHD_stop_daemon, MHD_stop_daemonp, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct MHD_Response*, sym_MHD_destroy_response, MHD_destroy_responsep, NULL);
-
-#else
-#define DLOPEN_MICROHTTPD(log_level, priority) dlopen_microhttpd(log_level)
#endif
+
+int dlopen_microhttpd(int log_level);
+
+#define DLOPEN_MICROHTTPD(log_level, priority) \
+ ({ \
+ LIBMICROHTTPD_NOTE(priority); \
+ dlopen_microhttpd(log_level); \
+ })
#include <syslog.h>
-#include "sd-dlopen.h"
-
#include "log.h"
#include "module-util.h"
#include "proc-cmdline.h"
#if HAVE_KMOD
static void *libkmod_dl = NULL;
- LIBKMOD_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBKMOD_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libkmod_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_KMOD
int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose);
int module_setup_context(struct kmod_ctx **ret);
-#define LIBKMOD_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("kmod", \
- "Support for loading kernel modules", \
- priority, \
- "libkmod.so.2")
-
-#define DLOPEN_LIBKMOD(log_level, priority) \
- ({ \
- LIBKMOD_NOTE(priority); \
- dlopen_libkmod(log_level); \
- })
#else
struct kmod_ctx;
-
static inline int module_setup_context(struct kmod_ctx **ret) {
return -EOPNOTSUPP;
}
return -EOPNOTSUPP;
}
-#define DLOPEN_LIBKMOD(log_level, priority) dlopen_libkmod(log_level)
#endif
int dlopen_libkmod(int log_level);
+
+#define DLOPEN_LIBKMOD(log_level, priority) \
+ ({ \
+ LIBKMOD_NOTE(priority); \
+ dlopen_libkmod(log_level); \
+ })
#include <syslog.h>
#include "sd-bus.h"
-#include "sd-dlopen.h"
#include "alloc-util.h"
#include "bus-internal.h"
#if HAVE_PAM
static void *libpam_dl = NULL;
- LIBPAM_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBPAM_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libpam_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_PAM
/* Equivalent of pam_misc_setenv(pamh, name, value, 0), without the libpam_misc dep — builds "name=value"
* and hands it to sym_pam_putenv(), then erases the buffer before freeing in case it carried a secret. */
int pam_putenv_assign(pam_handle_t *pamh, const char *name, const char *value);
+#endif
-#define LIBPAM_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("pam", \
- "Support for LinuxPAM", \
- priority, \
- "libpam.so.0")
+int dlopen_libpam(int log_level);
#define DLOPEN_LIBPAM(log_level, priority) \
({ \
LIBPAM_NOTE(priority); \
dlopen_libpam(log_level); \
})
-#else
-#define DLOPEN_LIBPAM(log_level, priority) dlopen_libpam(log_level)
-#endif
-
-int dlopen_libpam(int log_level);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "password-quality-util-passwdqc.h"
-
+#include "dlopen-note.h"
#include "errno-util.h" /* IWYU pragma: keep */
#include "log.h" /* IWYU pragma: keep */
+#include "password-quality-util-passwdqc.h"
#if HAVE_PASSWDQC
#ifndef SYSTEMD_CFLAGS_MARKER_LIBPWQUALITY
#include <passwdqc.h>
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "memory-util.h"
#if HAVE_PASSWDQC
static void *passwdqc_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "passwdqc",
- "Support for password quality checks",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libpasswdqc.so.1");
+ LIBPASSWDQC_NOTE(suggested);
return dlopen_many_sym_or_warn(
&passwdqc_dl, "libpasswdqc.so.1", log_level,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "password-quality-util-pwquality.h"
-
+#include "dlopen-note.h"
#include "errno-util.h"
#include "log.h"
+#include "password-quality-util-pwquality.h"
#if HAVE_PWQUALITY
#ifndef SYSTEMD_CFLAGS_MARKER_LIBPWQUALITY
#include <stdio.h>
#include <unistd.h>
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "password-quality-util.h"
#if HAVE_PWQUALITY
static void *pwquality_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "pwquality",
- "Support for password quality checks",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libpwquality.so.1");
+ LIBPWQUALITY_NOTE(suggested);
return dlopen_many_sym_or_warn(
&pwquality_dl, "libpwquality.so.1", log_level,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "hash-funcs.h"
#include "log.h"
#include "pcre2-util.h"
#if HAVE_PCRE2
static void *pcre2_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "pcre2",
- "Support for regular expressions",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libpcre2-8.so.0");
+ LIBPCRE2_NOTE(suggested);
/* So here's something weird: PCRE2 actually renames the symbols exported by the library via C
* macros, so that the exported symbols carry a suffix "_8" but when used from C the suffix is
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "ask-password-api.h"
#include "crypto-util.h"
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "env-util.h"
#include "escape.h"
#include "format-table.h"
#if HAVE_P11KIT
static void *p11kit_dl = NULL;
- SD_ELF_NOTE_DLOPEN(
- "p11-kit",
- "Support for PKCS11 hardware tokens",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libp11-kit.so.0");
+ LIBP11KIT_NOTE(suggested);
return dlopen_many_sym_or_warn(
&p11kit_dl,
#endif
#include <stdio.h>
-#include "sd-dlopen.h"
-
#include "ansi-color.h"
#include "dlfcn-util.h"
+#include "dlopen-note.h"
#include "locale-util.h"
#include "log.h"
#include "strv.h"
static void *qrcode_dl = NULL;
int r;
- SD_ELF_NOTE_DLOPEN(
- "qrencode",
- "Support for generating QR codes",
- SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
- "libqrencode.so.4", "libqrencode.so.3");
+ LIBQRENCODE_NOTE(suggested);
FOREACH_STRING(s, "libqrencode.so.4", "libqrencode.so.3") {
r = dlopen_many_sym_or_warn(
#include <asm/sgidefs.h>
#endif
-#include "sd-dlopen.h"
-
#include "af-list.h"
#include "alloc-util.h"
#include "env-util.h"
#if HAVE_SECCOMP
static void *libseccomp_dl = NULL;
- LIBSECCOMP_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBSECCOMP_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libseccomp_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "errno-util.h"
#include "shared-forward.h"
int seccomp_suppress_sync(void);
-#define LIBSECCOMP_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("seccomp", \
- "Support for Seccomp Sandboxes", \
- priority, \
- "libseccomp.so.2")
-
-#define DLOPEN_LIBSECCOMP(log_level, priority) \
- ({ \
- LIBSECCOMP_NOTE(priority); \
- dlopen_libseccomp(log_level); \
- })
#else
static inline bool is_seccomp_available(void) {
}
-#define DLOPEN_LIBSECCOMP(log_level, priority) dlopen_libseccomp(log_level)
#endif
int dlopen_libseccomp(int log_level);
+#define DLOPEN_LIBSECCOMP(log_level, priority) \
+ ({ \
+ LIBSECCOMP_NOTE(priority); \
+ dlopen_libseccomp(log_level); \
+ })
+
/* This is a special value to be used where syscall filters otherwise expect errno numbers, will be
replaced with real seccomp action. */
enum {
#include <selinux/label.h>
#include <selinux/selinux.h>
-#include "sd-dlopen.h"
-
#include "alloc-util.h"
#include "fd-util.h"
#include "path-util.h"
#if HAVE_SELINUX
static void *libselinux_dl = NULL;
- LIBSELINUX_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ LIBSELINUX_NOTE(recommended);
return dlopen_many_sym_or_warn(
&libselinux_dl,
#include <sys/socket.h>
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_SELINUX
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(char*, sym_freecon, freeconp, NULL);
-#define LIBSELINUX_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("selinux", \
- "Support for SELinux", \
- priority, \
- "libselinux.so.1")
-
-#define DLOPEN_LIBSELINUX(log_level, priority) \
- ({ \
- LIBSELINUX_NOTE(priority); \
- dlopen_libselinux(log_level); \
- })
#else
-
static inline void freeconp(char **p) {
assert(*p == NULL);
}
-#define DLOPEN_LIBSELINUX(log_level, priority) dlopen_libselinux(log_level)
#endif
int dlopen_libselinux(int log_level);
+#define DLOPEN_LIBSELINUX(log_level, priority) \
+ ({ \
+ LIBSELINUX_NOTE(priority); \
+ dlopen_libselinux(log_level); \
+ })
+
#define _cleanup_freecon_ _cleanup_(freeconp)
/* This accepts 0 error, like _zerook(). */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "sd-dlopen.h"
-
#include "log.h" /* IWYU pragma: keep */
#include "ssl-util.h"
#include "strv.h"
static void *libssl_dl = NULL;
int r;
- LIBSSL_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBSSL_NOTE(suggested);
FOREACH_STRING(soname, "libssl.so.4", "libssl.so.3") {
r = dlopen_many_sym_or_warn(
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
+#include "dlopen-note.h"
#include "shared-forward.h"
-int dlopen_libssl(int log_level);
-
#if HAVE_OPENSSL
#ifndef SYSTEMD_CFLAGS_MARKER_LIBOPENSSL
# error "missing libopenssl_cflags in meson dependency."
#endif
-#define LIBSSL_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("libssl", \
- "Support for TLS", \
- priority, \
- "libssl.so.4", "libssl.so.3")
-
-#define DLOPEN_LIBSSL(log_level, priority) \
- ({ \
- LIBSSL_NOTE(priority); \
- dlopen_libssl(log_level); \
- })
-
# include <openssl/ssl.h> /* IWYU pragma: export */
# include "dlfcn-util.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(SSL*, sym_SSL_free, SSL_freep, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(SSL_CTX*, sym_SSL_CTX_free, SSL_CTX_freep, NULL);
-
-#else
-#define DLOPEN_LIBSSL(log_level, priority) dlopen_libssl(log_level)
#endif
+
+int dlopen_libssl(int log_level);
+
+#define DLOPEN_LIBSSL(log_level, priority) \
+ ({ \
+ LIBSSL_NOTE(priority); \
+ dlopen_libssl(log_level); \
+ })
#include <unistd.h>
#include "sd-device.h"
-#include "sd-dlopen.h"
#include "alloc-util.h"
#include "ansi-color.h"
static void *libtss2_esys_dl = NULL;
int r;
- TPM2_ESYS_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBTSS2_ESYS_NOTE(suggested);
r = dlopen_many_sym_or_warn(
&libtss2_esys_dl, "libtss2-esys.so.0", log_level,
static int dlopen_tpm2_rc(int log_level) {
static void *libtss2_rc_dl = NULL;
- TPM2_RC_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBTSS2_RC_NOTE(suggested);
return dlopen_many_sym_or_warn(
&libtss2_rc_dl, "libtss2-rc.so.0", log_level,
static int dlopen_tpm2_mu(int log_level) {
static void *libtss2_mu_dl = NULL;
- TPM2_MU_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBTSS2_MU_NOTE(suggested);
return dlopen_many_sym_or_warn(
&libtss2_mu_dl, "libtss2-mu.so.0", log_level,
/* The "device" TCTI is the most relevant one, let's also load it explicitly on dlopen_tpm2(), even
* if we don't resolve any symbols here. */
- TPM2_TCTI_DEVICE_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
+ LIBTSS2_TCTI_DEVICE_NOTE(suggested);
return dlopen_verbose(
&libtss2_tcti_device_dl,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dlopen.h"
-
#include "bitfield.h"
+#include "dlopen-note.h"
#include "iovec-util.h"
#include "shared-forward.h"
#include "sha256.h"
* other tokens. */
#define ERRNO_IS_NEG_TPM2_TOKEN_MISMATCH(r) IN_SET(r, -EREMCHG, -ENOANO, -EPERM, -ENOSTR, -EREMOTE, -EADDRNOTAVAIL)
-#if HAVE_TPM2
-#ifndef SYSTEMD_CFLAGS_MARKER_TPM2
-# error "missing tpm2_cflags in meson dependency."
-#endif
-
-#define TPM2_ESYS_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("tpm", "Support for TPM", priority, "libtss2-esys.so.0")
-#define TPM2_RC_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("tpm", "Support for TPM", priority, "libtss2-rc.so.0")
-#define TPM2_MU_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("tpm", "Support for TPM", priority, "libtss2-mu.so.0")
-#define TPM2_TCTI_DEVICE_NOTE(priority) \
- SD_ELF_NOTE_DLOPEN("tpm", "Support for TPM", priority, "libtss2-tcti-device.so.0")
-
-#define TPM2_NOTE(priority) \
- ({ \
- TPM2_ESYS_NOTE(priority); \
- TPM2_RC_NOTE(priority); \
- TPM2_MU_NOTE(priority); \
- TPM2_TCTI_DEVICE_NOTE(priority); \
- })
-
#define DLOPEN_TPM2(log_level, priority) \
({ \
TPM2_NOTE(priority); \
dlopen_tpm2(log_level); \
})
+#if HAVE_TPM2
+#ifndef SYSTEMD_CFLAGS_MARKER_TPM2
+# error "missing tpm2_cflags in meson dependency."
+#endif
+
#include <tss2/tss2_esys.h> /* IWYU pragma: export */
#include <tss2/tss2_mu.h> /* IWYU pragma: export */
#include <tss2/tss2_rc.h> /* IWYU pragma: export */
static inline int tpm2_pcrlock_search_file(const char *path, FILE **ret_file, char **ret_path) {
return -ENOENT;
}
-
-#define DLOPEN_TPM2(log_level, priority) dlopen_tpm2(log_level)
#endif /* HAVE_TPM2 */
int tpm2_list_devices(bool legend, bool quiet);
assert(head);
- r = DLOPEN_LIBMOUNT(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBMOUNT(LOG_ERR, recommended);
if (r < 0)
return r;
bool need_to_reload;
int r;
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, required);
r = get_extension_release_metadata(image_class, hierarchies, no_reload, &need_to_reload, &units_to_restart, &units_to_reload_or_restart);
if (r < 0)
int r;
- (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBBLKID(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ (void) DLOPEN_CRYPTSETUP(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBBLKID(LOG_DEBUG, required);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, required);
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
r = pidref_safe_fork("(sd-merge)", FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_NEW_MOUNTNS, &pidref);
POINTER_MAY_BE_NULL(partition_type);
assert(ret);
- r = DLOPEN_FDISK(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_FDISK(LOG_DEBUG, recommended);
if (r < 0)
return r;
if (change == 0) /* Nothing to do */
return 0;
- r = DLOPEN_FDISK(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_FDISK(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(rr);
- r = DLOPEN_FDISK(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_FDISK(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(cond_exec);
assert(ret);
- r = DLOPEN_LIBACL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBACL(LOG_DEBUG, recommended);
if (r < 0)
return r;
assert(c);
- r = DLOPEN_LIBACL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ r = DLOPEN_LIBACL(LOG_DEBUG, recommended);
if (r < 0)
return r;
return EXIT_SUCCESS;
}
- r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
- r = DLOPEN_TPM2(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_TPM2(LOG_ERR, required);
if (r < 0)
return r;
int64_t offset = 0;
int r;
- r = DLOPEN_LIBBLKID(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBBLKID(LOG_DEBUG, required);
if (r < 0)
return log_device_debug_errno(dev, r, "blkid not available: %m");
return log_error_errno(r, "Failed to create /run/udev: %m");
/* Load some shared libraries before we fork any workers */
- (void) DLOPEN_LIBACL(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBBLKID(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBKMOD(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_LIBMOUNT(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
- (void) DLOPEN_TPM2(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
+ (void) DLOPEN_LIBACL(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBBLKID(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBKMOD(LOG_DEBUG, recommended);
+ (void) DLOPEN_LIBMOUNT(LOG_DEBUG, recommended);
+ (void) DLOPEN_TPM2(LOG_DEBUG, recommended);
if (arg_daemonize) {
pid_t pid;
assert(d);
assert(f);
- r = DLOPEN_LIBBLKID(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_LIBBLKID(LOG_ERR, required);
if (r < 0)
return r;
log_setup();
- r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+ r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
if (r < 0)
return r;