Project

General

Profile

Actions

Bug #1361

closed

lttng: Fix reproducibility issues

Added by Alexander Kanavin about 2 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
10/21/2022
Due date:
% Done:

100%

Estimated time:

Description

Yocto has added a patch to fix reproducibility issues:
https://git.yoctoproject.org/poky/tree/meta/recipes-kernel/lttng/lttng-tools/determinism.patch

The description from RP is: =======
Add a hack to hardcode in specific rpaths which we then remove,
allowing the build to be reproducible.

This is a bit ugly. Specifing abs_builddir as an RPATH is plain wrong when
cross compiling. Sadly, removing the rpath makes libtool/automake do
weird things and breaks the build as shared libs are no longer generated.

We already try and delete the RPATH at do_install with chrpath however
that does leave the path in the string table so it doesn't help us
with reproducibility.

Instead, hack in a bogus but harmless path, then delete it later in
our do_install. Ultimately we may want to pass a specific path to use
to configure if we really do need to set an RPATH at all. It is unclear
to me whether the tests need that or not.

Fixes reproducibility issues for lttng-tools.

Upstream-Status: Pending [needs discussion with upstream about the correct solution] ====

And so this bug is created so that the discussion can take place :-)

Actions #1

Updated by Jérémie Galarneau about 2 years ago

  • Status changed from New to Feedback
  • Assignee set to Jérémie Galarneau

Hi Alexander!

I don't have a radically different solution to propose.

diff --git a/tests/regression/ust/ust-dl/Makefile.am b/tests/regression/ust/ust-dl/Makefile.am
index 366b02bb0..322a2c65f 100644
--- a/tests/regression/ust/ust-dl/Makefile.am
+++ b/tests/regression/ust/ust-dl/Makefile.am
@@ -31,16 +31,16 @@ noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la libtp.la

 libzzz_la_SOURCES = libzzz.c libzzz.h
 libzzz_la_LDFLAGS = -module -shared -avoid-version \
-        -rpath $(abs_builddir)
+        -rpath $(libdir)

 libbar_la_SOURCES = libbar.c libbar.h
 libbar_la_LDFLAGS = -module -shared -avoid-version \
-        -rpath $(abs_builddir)
+        -rpath $(libdir)
 libbar_la_LIBADD = libzzz.la

 libfoo_la_SOURCES = libfoo.c libfoo.h
 libfoo_la_LDFLAGS = -module -shared -avoid-version \
-        -rpath $(abs_builddir)
+        -rpath $(libdir)
 libfoo_la_LIBADD = libbar.la

 CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
@@ -48,7 +48,7 @@ CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \

 libtp_la_SOURCES = libbar-tp.h libbar-tp.c libfoo-tp.h libfoo-tp.c \
     libzzz-tp.h libzzz-tp.c
-libtp_la_LDFLAGS = -module -shared -rpath $(abs_builddir)
+libtp_la_LDFLAGS = -module -shared -rpath $(libdir)

 # Extract debug symbols
 libfoo.so.debug: libfoo.la

As you can see, I'm just using $libdir instead of hard-cording /usr/lib. It doesn't change much, but the resulting rpath is consistent with the rest of the artifacts produced.

$ readelf -a tests/regression/ust/ust-dl/libbar.so | grep RPATH
 0x000000000000000f (RPATH)              Library rpath: [/home/jgalar/EfficiOS/src/lttng-tools/tests/regression/ust/ust-dl/.libs:/tmp/lttng/lib]

$ readelf -a src/bin/lttng/.libs/lttng | grep RPATH
 0x000000000000000f (RPATH)              Library rpath: [/tmp/lttng/lib]

Would that still solve the problem on your end?

Actions #2

Updated by Alexander Kanavin about 2 years ago

It probably would - can you provide a commit i can cherry-pick?

Actions #3

Updated by Jérémie Galarneau about 2 years ago

Hi Alexander,

See https://review.lttng.org/c/lttng-tools/+/8868

You can cherry-pick it like this:

git fetch https://review.lttng.org/lttng-tools refs/changes/68/8868/1 && git cherry-pick FETCH_HEAD

Thanks!

Actions #4

Updated by Alexander Kanavin about 2 years ago

Not entirely. After replacing RP's patch with yours, there is still

```
WARNING: lttng-tools-2.13.8-r0 do_package_qa: QA Issue: File /usr/lib/lttng-tools/ptest/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary in package lttng-tools-ptest contains reference to TMPDIR [buildpaths]
```

Without any patches, there is also:
```
File /usr/lib/lttng-tools/ptest/tests/regression/ust/ust-dl/libbar.so in package lttng-tools-ptest contains reference to TMPDIR
File /usr/lib/lttng-tools/ptest/tests/regression/ust/ust-dl/libfoo.so in package lttng-tools-ptest contains reference to TMPDIR [buildpaths]
```

Actions #5

Updated by Jérémie Galarneau about 2 years ago

Can you test a new version of the patch?

git fetch https://review.lttng.org/lttng-tools refs/changes/68/8868/2 && git cherry-pick FETCH_HEAD
Actions #6

Updated by Alexander Kanavin about 2 years ago

Seems fine, all warnings are gone.

Actions #7

Updated by Jérémie Galarneau about 2 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF