[PATCH v2] libebl: recognize FDO Packaging Metadata ELF note

Luca Boccassi bluca@debian.org
Mon Mar 28 10:41:20 GMT 2022


On Mon, 2022-03-28 at 11:57 +0200, Mark Wielaard wrote:
> Hi Luca,
> 
> On Sat, 2022-03-26 at 18:19 +0000, Luca Boccassi wrote:
> > > Already working on the updated script, the native type is exactly
> > > the
> > > approach I was taking, this works fine on a Debian machine on s390x
> > > (and also on x86_64), eg:
> > > 
> > > -        BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of
> > > Owner including NUL */
> > > -        BYTE(0x47) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of
> > > Value including NUL */
> > > -        BYTE(0x7e) BYTE(0x1a) BYTE(0xfe) BYTE(0xca) /* Note ID */
> > > +        LONG(0x04)                                  /* Length of
> > > Owner including NUL */
> > > +        LONG(0x0047)                                /* Length of
> > > Value including NUL */
> > > +        LONG(0xcafe1a7e)                            /* Note ID */
> > > 
> > > The rest of the fields are C strings so no change needed, I
> > > believe.
> > > 
> > > Does this look right to you as well?
> > 
> > Here's the fix:
> > 
> > https://src.fedoraproject.org/rpms/package-notes/pull-request/3#
> > 
> > Now it's up to the Fedora folks what to do with it. I tested the
> > updated script on Debian x86_64 and s390x, and it all works as
> > intended. Sorry again for the breakage!
> 
> Yes, that looks correct. Note that the example on 
> https://systemd.io/COREDUMP_PACKAGE_METADATA/ also uses BYTEs for
> everything, instead of LONGs for the namesz, descsz and type words.
> 
> This also seems to make sure everything is aligned (at 4 bytes). An ELF
> note is defined as an array of (4 byte) words. Where the first 3
> (n_namesz, n_descsz, n_type) have a special interpretation. Your name
> string is also exactly 4 bytes "FDO\0", so you don't need any extra
> padding to make the start of the descriptor be aligned. And since you
> don't add any other notes to the section you don't need to explicitly
> pad the description. The linker should take care of that in case it
> merges note sections/segments.

Fix for the doc is queued too:
https://github.com/systemd/systemd/pull/22879

> Still I would really recommend trying to add native support to linkers
> for package notes, just like they support build-ids by default. That
> also makes it easier for the linker to simply merge the notes. Trying
> to do this with inserting a linker script really feels very fragile.

Yes, that would definitely be ideal. But a bit of a chicken-and-egg: we
had to get the spec established before there's any realistic change of
getting a full new feature merged in BFD, but we can't get it
established if we can't use it anywhere. This way we can 'bootstrap'
ourselves, and once the idea and usage is more widely accepted, we have
a good case to do just that.

-- 
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://sourceware.org/pipermail/elfutils-devel/attachments/20220328/55e62969/attachment.sig>


More information about the Elfutils-devel mailing list