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

use LONG instead of BYTEs for binary fields #31

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

bluca
Copy link
Member

@bluca bluca commented Mar 26, 2022

We hard-code little-endian byte sequences for binary fields, but
that clearly doesn't work on big endian architectures like s390x.
Switch to single LONG per 4-bytes field, so that the right thing
happens automatically.

Displaying notes found in: .note.package
Owner Data size Description
readelf: /usr/bin/bash: Warning: note with invalid namesz and/or descsz
found at offset 0x0
readelf: /usr/bin/bash: Warning: type: 0x7e1afeca, namesize:
0x04000000, descsize: 0x78000000, alignment: 4

We hard-code little-endian byte sequences for binary fields, but
that clearly doesn't work on big endian architectures like s390x.
Switch to single LONG per 4-bytes field, so that the right thing
happens automatically.

Displaying notes found in: .note.package
  Owner                Data size        Description
readelf: /usr/bin/bash: Warning: note with invalid namesz and/or descsz
found at offset 0x0
readelf: /usr/bin/bash: Warning:  type: 0x7e1afeca, namesize:
0x04000000, descsize: 0x78000000, alignment: 4
bluca added a commit to bluca/systemd that referenced this pull request Mar 28, 2022
…DATA

The first three fields of a note are binary, so they are subject to
flipping due to endianess. Instead of a stream of bytes, just use
the native 4-bytes type so that it gets encoded automatically.

Implemented in the tools via: systemd/package-notes#31
keszybz pushed a commit to systemd/systemd that referenced this pull request Mar 28, 2022
…DATA

The first three fields of a note are binary, so they are subject to
flipping due to endianess. Instead of a stream of bytes, just use
the native 4-bytes type so that it gets encoded automatically.

Implemented in the tools via: systemd/package-notes#31
@bluca bluca requested a review from keszybz March 28, 2022 18:45
@keszybz keszybz merged commit a03c07c into systemd:main Mar 28, 2022
@bluca bluca deleted the binary_type branch March 28, 2022 19:31
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.

2 participants