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