Public bug reported:

tillitis-tkey-device-signer 1.0.2-2 fails to build in Ubuntu since
plucky, while it builds fine in Debian:

  Expected device app digest:
  b0b08e5b...f52efc76  signer/app.bin
  sha512sum -c signer/app.bin.sha512
  signer/app.bin: FAILED

https://launchpad.net/ubuntu/+source/tillitis-tkey-device-
signer/1.0.2-2/+build/32793643

The build intentionally fails if the device app differs from the
expected one, because a different app.bin changes the TKey CDI and
therefore the users' derived Ed25519 (SSH) keys. So updating the
checksum is not an option.

The difference comes from Ubuntu's ELF package metadata: Ubuntu's dpkg-
buildpackage exports ELF_PACKAGE_METADATA into the build environment,
and Ubuntu's linkers (ld.bfd and ld.lld) add a .note.package section
when it is set, even though the upstream Makefile ignores LDFLAGS. For
this bare-metal RISC-V firmware the note is placed in the loaded image
(before .data), which shifts the data addresses and changes app.bin.

Comparing the ELF from a plain "make" with the one from dpkg-
buildpackage, the only differences are the extra .note.package section
and the resulting address shifts. Building with ELF_PACKAGE_METADATA set
to anything reproduces the failure, and building without it gives the
expected hash.

Unexporting ELF_PACKAGE_METADATA in debian/rules fixes the build in a
stonking container: the hash check passes and the binary matches
Debian's. This is a no-op in Debian, so the change can be forwarded
there.

** Affects: tillitis-tkey-device-signer (Ubuntu)
     Importance: Undecided
     Assignee: Benjamin Drung (bdrung)
         Status: New


** Tags: ftbfs stonking

** Tags added: ftbfs stonking

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170295

Title:
  FTBFS: ELF package metadata note changes the device app hash

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tillitis-tkey-device-signer/+bug/2170295/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to