dlopen-note: move all dlopen notes to dlopen-note.h

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
```
This commit is contained in:
Yu Watanabe
2026-07-10 16:34:26 +09:00
parent aa0db003cf
commit a74b3e1778
114 changed files with 772 additions and 575 deletions
+3 -3
View File
@@ -1416,11 +1416,11 @@ endif
# 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()))
+2 -2
View File
@@ -626,7 +626,7 @@ static int assess_system_call_filter(
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;
@@ -2604,7 +2604,7 @@ static int get_security_info(Unit *u, ExecContext *c, CGroupContext *g, RuntimeS
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;
+6 -27
View File
@@ -43,12 +43,11 @@
#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"
@@ -293,11 +292,7 @@ int dlopen_xz(int log_level) {
#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,
@@ -318,11 +313,7 @@ int dlopen_lz4(int log_level) {
#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,
@@ -352,11 +343,7 @@ int dlopen_zstd(int log_level) {
#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,
@@ -387,11 +374,7 @@ int dlopen_zlib(int log_level) {
#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,
@@ -412,11 +395,7 @@ int dlopen_bzip2(int log_level) {
#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,
+91
View File
@@ -0,0 +1,91 @@
/* 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)
+1 -1
View File
@@ -1085,7 +1085,7 @@ static int install_secure_boot_auto_enroll(InstallContext *c) {
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;
+1 -1
View File
@@ -31,7 +31,7 @@ int bpf_bind_network_interface_supported(void) {
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();
+1 -1
View File
@@ -78,7 +78,7 @@ bool bpf_restrict_fs_supported(bool initialize) {
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");
+2 -2
View File
@@ -171,7 +171,7 @@ bool bpf_restrict_fsaccess_supported(void) {
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");
@@ -340,7 +340,7 @@ static int restrict_fsaccess_validate_deserialized_fds(Manager *m) {
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.");
+1 -1
View File
@@ -86,7 +86,7 @@ int bpf_restrict_ifaces_supported(void) {
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);
+1 -1
View File
@@ -125,7 +125,7 @@ int bpf_socket_bind_supported(void) {
_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);
+8 -8
View File
@@ -1310,7 +1310,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, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
r = DLOPEN_LIBPAM(LOG_ERR, recommended);
if (r < 0)
return r;
@@ -1576,7 +1576,7 @@ static bool seccomp_allows_drop_privileges(const ExecContext *c) {
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 */
@@ -1886,7 +1886,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, SD_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED);
r = DLOPEN_BPF(LOG_DEBUG, recommended);
if (r < 0)
return r;
@@ -6000,12 +6000,12 @@ int exec_invoke(
}
/* 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 */
+3 -3
View File
@@ -1575,7 +1575,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
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) {
@@ -1994,7 +1994,7 @@ char** exec_context_get_syscall_filter(const ExecContext *c) {
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;
@@ -2063,7 +2063,7 @@ char** exec_context_get_syscall_log(const ExecContext *c) {
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;
+1 -1
View File
@@ -3814,7 +3814,7 @@ static int run_systemd(int argc, char *argv[]) {
}
/* 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;
+1 -1
View File
@@ -2407,7 +2407,7 @@ static int mount_test_startable(Unit *u) {
}
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) {
+1 -1
View File
@@ -3986,7 +3986,7 @@ int refresh_extensions_in_namespace(
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)
+1 -1
View File
@@ -17,7 +17,7 @@ int mac_selinux_setup(bool *loaded_policy) {
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;
+1 -1
View File
@@ -188,7 +188,7 @@ static int is_tmpfs_with_noswap(dev_t devno) {
_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;
+2 -2
View File
@@ -344,7 +344,7 @@ static int vl_method_enroll(
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;
@@ -421,7 +421,7 @@ static int vl_method_list_slots(
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;
+1 -1
View File
@@ -1036,7 +1036,7 @@ static int run(int argc, char *argv[]) {
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;
@@ -37,7 +37,7 @@ _public_ int cryptsetup_token_open_pin(
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;
@@ -102,7 +102,7 @@ _public_ void cryptsetup_token_dump(
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);
@@ -169,7 +169,7 @@ _public_ int cryptsetup_token_validate(
assert(json);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
@@ -36,7 +36,7 @@ _public_ int cryptsetup_token_open_pin(
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;
@@ -94,7 +94,7 @@ _public_ void cryptsetup_token_dump(
_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);
@@ -124,7 +124,7 @@ _public_ int cryptsetup_token_validate(
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;
@@ -70,7 +70,7 @@ _public_ int cryptsetup_token_open_pin(
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;
@@ -210,7 +210,7 @@ _public_ void cryptsetup_token_dump(
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);
@@ -304,7 +304,7 @@ _public_ int cryptsetup_token_validate(
assert(json);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
if (r < 0)
return r;
+2 -2
View File
@@ -538,7 +538,7 @@ static int parse_one_option(const char *option) {
#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;
@@ -2893,7 +2893,7 @@ static int run(int argc, char *argv[]) {
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;
+1 -1
View File
@@ -493,7 +493,7 @@ static int parse_argv(int argc, char *argv[]) {
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;
+1 -1
View File
@@ -33,7 +33,7 @@ static int resize_crypt_luks_device(dev_t devno, const char *fstype, dev_t main_
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;
+1 -1
View File
@@ -2501,7 +2501,7 @@ static int verb_list_signing_keys(int argc, char *argv[], uintptr_t _data, void
/* 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;
+1 -1
View File
@@ -1537,7 +1537,7 @@ int manager_startup(Manager *m) {
assert(m);
r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
+4 -4
View File
@@ -232,7 +232,7 @@ static int fscrypt_slot_try_v1(
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;
@@ -331,7 +331,7 @@ static int fscrypt_slot_try_v2(
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;
@@ -700,7 +700,7 @@ static int fscrypt_slot_set(
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;
@@ -813,7 +813,7 @@ int home_create_fscrypt(
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;
+11 -11
View File
@@ -146,7 +146,7 @@ static int probe_file_system_by_fd(
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;
@@ -529,7 +529,7 @@ static int acquire_open_luks_device(
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;
@@ -684,7 +684,7 @@ static int luks_validate(
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;
@@ -805,7 +805,7 @@ static int crypt_device_to_evp_cipher(struct crypt_device *cd, const EVP_CIPHER
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;
@@ -1293,7 +1293,7 @@ int home_setup_luks(
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;
@@ -1594,7 +1594,7 @@ int home_activate_luks(
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;
@@ -2211,11 +2211,11 @@ int home_create_luks(
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;
@@ -3250,11 +3250,11 @@ int home_resize_luks(
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;
@@ -3712,7 +3712,7 @@ int home_passwd_luks(
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;
+1 -1
View File
@@ -1328,7 +1328,7 @@ static int determine_default_storage(UserStorage *ret) {
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 {
+5 -5
View File
@@ -786,7 +786,7 @@ _public_ PAM_EXTERN int pam_sm_authenticate(
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;
@@ -851,7 +851,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
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;
@@ -908,7 +908,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
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;
@@ -973,7 +973,7 @@ _public_ PAM_EXTERN int pam_sm_acct_mgmt(
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;
@@ -1092,7 +1092,7 @@ _public_ PAM_EXTERN int pam_sm_chauthtok(
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;
+1 -1
View File
@@ -3053,7 +3053,7 @@ static int run(int argc, char* argv[]) {
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;
+2 -2
View File
@@ -32,7 +32,7 @@ int import_fork_tar_x(int tree_fd, int userns_fd, PidRef *ret_pid) {
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;
@@ -99,7 +99,7 @@ int import_fork_tar_c(int tree_fd, int userns_fd, PidRef *ret_pid) {
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;
+1 -1
View File
@@ -281,7 +281,7 @@ static int pull_job_open_disk(PullJob *j) {
}
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;
+1 -1
View File
@@ -204,7 +204,7 @@ static int run(int argc, char *argv[]) {
log_setup();
r = DLOPEN_CRYPTSETUP(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
if (r < 0)
return r;
+1 -1
View File
@@ -1265,7 +1265,7 @@ static int run(int argc, char *argv[]) {
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;
+1 -1
View File
@@ -468,7 +468,7 @@ static int setup_microhttpd_server(RemoteServer *s,
#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;
+1 -1
View File
@@ -879,7 +879,7 @@ static int run(int argc, char **argv) {
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;
+1 -1
View File
@@ -70,7 +70,7 @@ int action_setup_keys(void) {
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;
+1 -1
View File
@@ -233,7 +233,7 @@ static int verb_extract_public(int argc, char *argv[], uintptr_t _data, void *us
return r;
}
r = DLOPEN_LIBCRYPTO(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
r = DLOPEN_LIBCRYPTO(LOG_ERR, required);
if (r < 0)
return r;
+2 -6
View File
@@ -1,8 +1,7 @@
/* 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"
@@ -17,10 +16,7 @@ DLSYM_PROTOTYPE(xkb_keymap_unref) = NULL;
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,
+2 -2
View File
@@ -1807,7 +1807,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
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;
@@ -1915,7 +1915,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
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;
+1 -1
View File
@@ -19,7 +19,7 @@ _public_ PAM_EXTERN int pam_sm_authenticate(
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;
+2 -2
View File
@@ -178,7 +178,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
"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;
@@ -1137,7 +1137,7 @@ static int run(int argc, char *argv[]) {
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;
+1 -1
View File
@@ -108,7 +108,7 @@ int manager_install_sysctl_monitor(Manager *manager) {
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)
+1 -1
View File
@@ -1826,7 +1826,7 @@ static int oci_seccomp(const char *name, sd_json_variant *v, sd_json_dispatch_fl
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");
+3 -3
View File
@@ -6141,9 +6141,9 @@ static int run(int argc, char *argv[]) {
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)
+1 -1
View File
@@ -68,7 +68,7 @@ int userns_restrict_install(
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;
+1 -1
View File
@@ -90,7 +90,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
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;
+1 -1
View File
@@ -5709,7 +5709,7 @@ static int run(int argc, char *argv[]) {
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;
+2 -2
View File
@@ -610,8 +610,8 @@ static int portable_extract_by_path(
* 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)
+8 -8
View File
@@ -3120,7 +3120,7 @@ static int partition_read_definition(
"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");
@@ -4739,7 +4739,7 @@ static int context_wipe_range(Context *context, uint64_t offset, uint64_t size)
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;
@@ -5431,7 +5431,7 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta
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;
@@ -5973,7 +5973,7 @@ static int partition_format_verity_hash(
(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;
@@ -6075,7 +6075,7 @@ static int sign_verity_roothash(
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;
@@ -7167,7 +7167,7 @@ static int partition_populate_filesystem(Context *context, Partition *p, const c
* 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)",
@@ -8798,7 +8798,7 @@ static int resolve_copy_blocks_auto_candidate(
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;
@@ -11620,7 +11620,7 @@ static int run(int argc, char *argv[]) {
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;
+1 -1
View File
@@ -304,7 +304,7 @@ static int vl_server(void) {
_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;
+1 -1
View File
@@ -64,7 +64,7 @@ static int http_upload_report(Context *context, sd_json_variant *report) {
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;
+3 -3
View File
@@ -735,7 +735,7 @@ int dnssec_verify_rrset(
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;
@@ -1092,7 +1092,7 @@ int dnssec_verify_dnskey_by_ds(DnsResourceRecord *dnskey, DnsResourceRecord *ds,
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;
@@ -1232,7 +1232,7 @@ int dnssec_nsec3_hash(DnsResourceRecord *nsec3, const char *name, void *ret) {
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;
+2 -2
View File
@@ -412,11 +412,11 @@ int dnstls_manager_init(Manager *manager) {
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;
+1 -1
View File
@@ -36,7 +36,7 @@ int resolve_system_hostname(char **full_hostname, char **first_label) {
#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),
+1 -1
View File
@@ -406,7 +406,7 @@ static int verb_sign(int argc, char *argv[], uintptr_t _data, void *userdata) {
_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;
+1 -3
View File
@@ -3,8 +3,6 @@
#include <sys/stat.h>
#include <sys/syslog.h>
#include "sd-dlopen.h"
#include "acl-util.h"
#include "alloc-util.h"
#include "errno-util.h"
@@ -49,7 +47,7 @@ int dlopen_libacl(int log_level) {
#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,
+7 -15
View File
@@ -1,8 +1,7 @@
/* 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
@@ -66,17 +65,6 @@ static inline int acl_set_perm(acl_permset_t ps, acl_perm_t p, bool b) {
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;
@@ -107,12 +95,16 @@ static inline int devnode_acl(int fd, const Set *uids) {
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);
+2 -7
View File
@@ -1,14 +1,13 @@
/* 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;
@@ -48,11 +47,7 @@ int dlopen_libapparmor(int log_level) {
#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,
+1 -2
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-dlopen.h"
#include "sd-id128.h"
#include "blkid-util.h"
@@ -99,7 +98,7 @@ int dlopen_libblkid(int log_level) {
#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,
+3 -12
View File
@@ -1,8 +1,7 @@
/* 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
@@ -68,20 +67,12 @@ enum {
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);
+1 -3
View File
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-dlopen.h"
#include "bpf-util.h"
#include "dlfcn-util.h"
#include "initrd-util.h"
@@ -90,7 +88,7 @@ int dlopen_bpf(int log_level) {
if (cached < 0)
return cached; /* Already tried, and failed. */
BPF_NOTE(SD_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED);
LIBBPF_NOTE(suggested);
DISABLE_WARNING_DEPRECATED_DECLARATIONS;
+8 -16
View File
@@ -3,7 +3,8 @@
#include <syslog.h>
#include "sd-dlopen.h"
#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_LIBBPF
#ifndef SYSTEMD_CFLAGS_MARKER_LIBBPF
@@ -14,7 +15,6 @@
#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.
@@ -92,20 +92,12 @@ static inline int compat_bpf_map_create(
* 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);
#define BPF_NOTE(priority) \
SD_ELF_NOTE_DLOPEN("bpf", \
"Support firewalling and sandboxing with BPF", \
priority, \
"libbpf.so.1", "libbpf.so.0")
#define DLOPEN_BPF(log_level, priority) \
({ \
BPF_NOTE(priority); \
dlopen_bpf(log_level); \
})
#else
#define DLOPEN_BPF(log_level, priority) dlopen_bpf(log_level)
#endif
int dlopen_bpf(int log_level);
#define DLOPEN_BPF(log_level, priority) \
({ \
LIBBPF_NOTE(priority); \
dlopen_bpf(log_level); \
})
+1 -3
View File
@@ -1,7 +1,5 @@
/* 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"
@@ -348,7 +346,7 @@ int dlopen_libcrypto(int log_level) {
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(
+10 -20
View File
@@ -1,11 +1,10 @@
/* 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,
@@ -28,8 +27,6 @@ int parse_openssl_certificate_source_argument(const char *argument, char **certi
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
@@ -37,18 +34,6 @@ int dlopen_libcrypto(int log_level);
# 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 */
@@ -459,7 +444,12 @@ int openssl_extract_public_key(EVP_PKEY *private_key, EVP_PKEY **ret);
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); \
})
+1 -2
View File
@@ -2,7 +2,6 @@
#include <stdlib.h>
#include "sd-dlopen.h"
#include "sd-json.h"
#include "alloc-util.h"
@@ -282,7 +281,7 @@ int dlopen_cryptsetup(int log_level) {
* 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,
+7 -16
View File
@@ -1,9 +1,8 @@
/* 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
@@ -98,24 +97,16 @@ int cryptsetup_add_token_json(struct crypt_device *cd, sd_json_variant *v);
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);
#define CRYPTSETUP_NOTE(priority) \
SD_ELF_NOTE_DLOPEN("cryptsetup", \
"Support for disk encryption, integrity, and authentication", \
priority, \
"libcryptsetup.so.12")
#define DLOPEN_CRYPTSETUP(log_level, priority) \
({ \
CRYPTSETUP_NOTE(priority); \
dlopen_cryptsetup(log_level); \
})
#else
#define DLOPEN_CRYPTSETUP(log_level, priority) dlopen_cryptsetup(log_level)
#endif
int dlopen_cryptsetup(int log_level);
#define DLOPEN_CRYPTSETUP(log_level, priority) \
({ \
LIBCRYPTSETUP_NOTE(priority); \
dlopen_cryptsetup(log_level); \
})
int cryptsetup_get_keyslot_from_token(sd_json_variant *v);
const char* mangle_none(const char *s);
+1 -2
View File
@@ -5,7 +5,6 @@
#if HAVE_LIBCURL
#include "sd-dlopen.h"
#include "sd-event.h"
#include "alloc-util.h"
@@ -604,7 +603,7 @@ int dlopen_curl(int log_level) {
#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,
+7 -16
View File
@@ -1,8 +1,7 @@
/* 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
@@ -76,20 +75,12 @@ int curl_append_to_header(struct curl_slist **list, char **headers);
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);
#define CURL_NOTE(priority) \
SD_ELF_NOTE_DLOPEN("curl", \
"Support for downloading and uploading files over HTTP", \
priority, \
"libcurl.so.4")
#define DLOPEN_CURL(log_level, priority) \
({ \
CURL_NOTE(priority); \
dlopen_curl(log_level); \
})
#else
#define DLOPEN_CURL(log_level, priority) dlopen_curl(log_level)
#endif
int dlopen_curl(int log_level);
#define DLOPEN_CURL(log_level, priority) \
({ \
LIBCURL_NOTE(priority); \
dlopen_curl(log_level); \
})
+381
View File
@@ -0,0 +1,381 @@
/* 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)
+3 -11
View File
@@ -12,12 +12,12 @@
#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"
@@ -100,11 +100,7 @@ int dlopen_dw(int log_level) {
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,
@@ -166,11 +162,7 @@ int dlopen_elf(int 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,
+1 -3
View File
@@ -5,8 +5,6 @@
#if HAVE_LIBFDISK
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "bitfield.h"
#include "dissect-image.h"
@@ -83,7 +81,7 @@ int dlopen_fdisk(int log_level) {
#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,
+7 -16
View File
@@ -1,8 +1,7 @@
/* 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
@@ -88,20 +87,12 @@ int fdisk_partition_get_type_as_id128(struct fdisk_partition *p, sd_id128_t *ret
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);
#define FDISK_NOTE(priority) \
SD_ELF_NOTE_DLOPEN("fdisk", \
"Support for reading and writing partition tables", \
priority, \
"libfdisk.so.1")
#define DLOPEN_FDISK(log_level, priority) \
({ \
FDISK_NOTE(priority); \
dlopen_fdisk(log_level); \
})
#else
#define DLOPEN_FDISK(log_level, priority) dlopen_fdisk(log_level)
#endif
int dlopen_fdisk(int log_level);
#define DLOPEN_FDISK(log_level, priority) \
({ \
LIBFDISK_NOTE(priority); \
dlopen_fdisk(log_level); \
})
+2 -7
View File
@@ -1,7 +1,6 @@
/* 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 */
@@ -23,11 +22,7 @@ int dlopen_gnutls(int log_level) {
#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,
+1 -3
View File
@@ -5,8 +5,6 @@
#if HAVE_LIBIDN2
#include "sd-dlopen.h"
static void* idn_dl = NULL;
DLSYM_PROTOTYPE(idn2_lookup_u8) = NULL;
@@ -17,7 +15,7 @@ DLSYM_PROTOTYPE(idn2_to_unicode_8z8z) = 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,
+7 -16
View File
@@ -1,8 +1,7 @@
/* 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
@@ -17,20 +16,12 @@
extern DLSYM_PROTOTYPE(idn2_lookup_u8);
extern const char *(*sym_idn2_strerror)(int rc) _const_;
extern DLSYM_PROTOTYPE(idn2_to_unicode_8z8z);
#define IDN_NOTE(priority) \
SD_ELF_NOTE_DLOPEN("idn", \
"Support for internationalized domain names", \
priority, \
"libidn2.so.0")
#define DLOPEN_IDN(log_level, priority) \
({ \
IDN_NOTE(priority); \
dlopen_idn(log_level); \
})
#else
#define DLOPEN_IDN(log_level, priority) dlopen_idn(log_level)
#endif
int dlopen_idn(int log_level);
#define DLOPEN_IDN(log_level, priority) \
({ \
LIBIDN2_NOTE(priority); \
dlopen_idn(log_level); \
})
+1 -3
View File
@@ -2,8 +2,6 @@
#include <syslog.h>
#include "sd-dlopen.h"
#include "libarchive-util.h"
#include "log.h" /* IWYU pragma: keep */
#include "user-util.h" /* IWYU pragma: keep */
@@ -80,7 +78,7 @@ int dlopen_libarchive(int log_level) {
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,
+3 -13
View File
@@ -1,8 +1,7 @@
/* 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
@@ -84,21 +83,12 @@ extern DLSYM_PROTOTYPE(archive_write_set_format_pax);
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);
+2 -7
View File
@@ -4,8 +4,7 @@
#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"
@@ -25,11 +24,7 @@ int dlopen_libaudit(int log_level) {
#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,
+3 -8
View File
@@ -7,10 +7,9 @@
# 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"
@@ -144,15 +143,11 @@ int dlopen_libcrypt(int log_level) {
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,
+2 -7
View File
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-dlopen.h"
#include "dlopen-note.h"
#include "libfido2-util.h"
#include "log.h"
@@ -86,11 +85,7 @@ int dlopen_libfido2(int log_level) {
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,
+1 -3
View File
@@ -7,8 +7,6 @@
#include <stdio.h>
#include "sd-dlopen.h"
#include "fstab-util.h"
DLSYM_PROTOTYPE(mnt_free_iter) = NULL;
@@ -120,7 +118,7 @@ int dlopen_libmount(int log_level) {
#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,
+7 -15
View File
@@ -1,8 +1,7 @@
/* 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
@@ -78,28 +77,21 @@ int libmount_is_leaf(
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); \
})
+1 -3
View File
@@ -2,8 +2,6 @@
#include <stdio.h>
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "gnutls-util.h"
#include "log.h"
@@ -36,7 +34,7 @@ int dlopen_microhttpd(int log_level) {
#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(
&microhttpd_dl,
+9 -19
View File
@@ -1,29 +1,14 @@
/* 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"
@@ -150,7 +135,12 @@ int setup_gnutls_logger(char **categories);
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); \
})
+1 -3
View File
@@ -2,8 +2,6 @@
#include <syslog.h>
#include "sd-dlopen.h"
#include "log.h"
#include "module-util.h"
#include "proc-cmdline.h"
@@ -173,7 +171,7 @@ int dlopen_libkmod(int log_level) {
#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,
+7 -15
View File
@@ -1,8 +1,7 @@
/* 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
@@ -40,22 +39,10 @@ DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct kmod_list*, sym_kmod_module_unref
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;
}
@@ -64,7 +51,12 @@ static inline int module_load_and_warn(struct kmod_ctx *ctx, const char *module,
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); \
})
+1 -2
View File
@@ -9,7 +9,6 @@
#include <syslog.h>
#include "sd-bus.h"
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "bus-internal.h"
@@ -383,7 +382,7 @@ int dlopen_libpam(int log_level) {
#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,
+3 -12
View File
@@ -1,8 +1,7 @@
/* 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
@@ -109,20 +108,12 @@ int pam_prompt_graceful(pam_handle_t *pamh, int style, char **ret_response, cons
/* 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);
+3 -9
View File
@@ -1,9 +1,9 @@
/* 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
@@ -12,8 +12,6 @@
#include <passwdqc.h>
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "memory-util.h"
@@ -143,11 +141,7 @@ int dlopen_passwdqc(int log_level) {
#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,
+3 -9
View File
@@ -1,9 +1,9 @@
/* 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
@@ -14,8 +14,6 @@
#include <stdio.h>
#include <unistd.h>
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "password-quality-util.h"
@@ -159,11 +157,7 @@ int dlopen_pwquality(int log_level) {
#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,
+2 -7
View File
@@ -1,8 +1,7 @@
/* 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"
@@ -30,11 +29,7 @@ int dlopen_pcre2(int log_level) {
#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
+2 -7
View File
@@ -1,11 +1,10 @@
/* 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"
@@ -1963,11 +1962,7 @@ int dlopen_p11kit(int log_level) {
#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,
+2 -7
View File
@@ -10,10 +10,9 @@
#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"
@@ -34,11 +33,7 @@ int dlopen_qrencode(int log_level) {
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(
+1 -3
View File
@@ -16,8 +16,6 @@
#include <asm/sgidefs.h>
#endif
#include "sd-dlopen.h"
#include "af-list.h"
#include "alloc-util.h"
#include "env-util.h"
@@ -2604,7 +2602,7 @@ int dlopen_libseccomp(int log_level) {
#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,
+7 -14
View File
@@ -1,8 +1,7 @@
/* 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"
@@ -161,17 +160,6 @@ int parse_syscall_and_errno(const char *in, char **name, int *error);
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) {
@@ -179,11 +167,16 @@ 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 {
+1 -3
View File
@@ -17,8 +17,6 @@
#include <selinux/label.h>
#include <selinux/selinux.h>
#include "sd-dlopen.h"
#include "alloc-util.h"
#include "fd-util.h"
#include "path-util.h"
@@ -94,7 +92,7 @@ int dlopen_libselinux(int log_level) {
#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,
+10 -18
View File
@@ -3,8 +3,7 @@
#include <sys/socket.h>
#include "sd-dlopen.h"
#include "dlopen-note.h"
#include "shared-forward.h"
#if HAVE_SELINUX
@@ -56,28 +55,21 @@ extern DLSYM_PROTOTYPE(string_to_security_class);
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")
#else
static inline void freeconp(char **p) {
assert(*p == NULL);
}
#endif
int dlopen_libselinux(int log_level);
#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 _cleanup_freecon_ _cleanup_(freeconp)

Some files were not shown because too many files have changed in this diff Show More