Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/ubuntu-core-initramfs: warn about missing dynamic dependencies #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valentindavid
Copy link
Collaborator

Now systemd loads most of libraries through dlopen. It also defines a .notes.dlopen section to ELF binaries to list those libraries. We use dlopen-notes to list those dependencies and warn about missing ones. And eventually fail for required ones.

@valentindavid
Copy link
Collaborator Author

valentindavid commented Oct 8, 2024

The current missing libraries on oracular are:

 * libtss2-mu.so.0 (suggested)
 * libqrencode.so.3 (suggested)
 * libdw.so.1 (suggested)
 * libip4tc.so.2 (suggested)
 * libtss2-esys.so.0 (suggested)
 * libelf.so.1 (suggested)
 * libidn2.so.0 (suggested)
 * libfido2.so.1 (suggested)
 * libbpf.so.1 (suggested)
 * libgcrypt.so.20 (suggested)
 * libarchive.so.13 (suggested)
 * libtss2-rc.so.0 (suggested)
 * libqrencode.so.4 (suggested)
 * libp11-kit.so.0 (suggested)
 * libbpf.so.0 (suggested)
 * libpwquality.so.1 (suggested)

@valentindavid
Copy link
Collaborator Author

Also this is useless on 24.04 as these notes do not exist yet.

Now systemd loads most of libraries through dlopen. It also defines a
.notes.dlopen section to ELF binaries to list those libraries.  We use
`dlopen-notes` to list those dependencies and warn about missing ones.
And eventually fail for required ones.
Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I have some comments, mainly about documentation.

sonames = dep["soname"]
priority = dep["priority"]
found_sonames = []
for soname in sonames:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a list of alternative implementation of the feature?

@@ -616,6 +611,58 @@ def create_initrd_pkg_list(dest_dir, sysroot):
pkgs).decode("utf-8")
pkg_list.write(out)

def verify_missing_dlopen(destdir, libdir):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need a comment saying what it does and why. Maybe also add an example json and maybe a link to where the format is defined. Naming the libraries that have this section would be good too (I see libsystemd-shared-256.so, but not sure if others have it).

print(f"WARNING: These sonames are missing:", file=sys.stderr)
for m, priority in missing.items():
print(f" * {m} ({priority})", file=sys.stderr)
if priority == "required":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should require any "recommended" library. I see there libkmod.so.2 and libzstd.so.1 and both are probably useful according to "feature".

if os.path.exists(os.path.join(destdir, dest)):
found_sonames.append(soname)
if not found_sonames:
for soname in sonames:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment to help the reader (afaiu this is for having the highest priority if the library is for more than one feature).

@alfonsosanchezbeato
Copy link
Member

Found the reference now: https://systemd.io/ELF_DLOPEN_METADATA/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants