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

Add tools and Debian packaging for parsing dlopen ELF notes #33

Merged
merged 3 commits into from
May 9, 2024

Conversation

bluca
Copy link
Member

@bluca bluca commented May 5, 2024

Spec and implementation at systemd/systemd#32234

dlopen-notes.py Outdated Show resolved Hide resolved
dlopen-notes.py Outdated Show resolved Hide resolved
dlopen-notes.py Outdated Show resolved Hide resolved
dlopen-notes.py Outdated Show resolved Hide resolved
@keszybz
Copy link
Member

keszybz commented May 8, 2024

I pushed another commit to rework the output to have more postprocessing.

@bluca
Copy link
Member Author

bluca commented May 8, 2024

I pushed another commit to rework the output to have more postprocessing.

Merged into the first commit with Co-authored-by - also added CI, and added back a way to print a "soname priority" list, that I need for the Debian tool, behind a new option

@bluca bluca marked this pull request as ready for review May 8, 2024 21:17
@bluca bluca force-pushed the dlopen branch 2 times, most recently from 4d6ba70 to 850a114 Compare May 8, 2024 21:45
@bluca
Copy link
Member Author

bluca commented May 8, 2024

I have no idea why it errors out in the CI, the string seems fine... also works locally, any idea?

@behrmann
Copy link

behrmann commented May 8, 2024

The bit

[{"feature":"fido2","description":"Support fido2 for encryption and authentication.","priority":"required","soname":["libfido2.so.1"]}]

in the output makes me think that the else path here

            try:
                if not isinstance(note_desc, str):
                    text = note_desc.decode('utf-8').rstrip('\0')
                else:
                    text = note_desc
                    print(text)
            except UnicodeDecodeError as e:
                raise ValueError(f'{filename}: Invalid UTF-8 in .note.dlopen n_desc') from e

is taken, but when I copy the above JSON into Emacs, it has a trailing null byte, which gives me the same error

json.decoder.JSONDecodeError: Extra data: line 1 column 136 (char 135)

Yes, unfortunately strings in Python can have null bytes, so stripping that might be what's needed.

@bluca bluca force-pushed the dlopen branch 2 times, most recently from 750a828 to 226230b Compare May 8, 2024 22:53
@bluca
Copy link
Member Author

bluca commented May 8, 2024

Indeed stripping that side of the if fixes the issue, thanks

dlopen-notes.py Outdated Show resolved Hide resolved
test/test.py Outdated Show resolved Hide resolved
bluca and others added 3 commits May 9, 2024 10:12
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
@bluca bluca merged commit 3ac107d into systemd:main May 9, 2024
1 check passed
@bluca bluca deleted the dlopen branch May 9, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants