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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user