Bug 1548823

Summary: libtalloc: Missing annobin annotations in Python 3 module on x86-64
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: libtallocAssignee: Simo Sorce <ssorce>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: asn, fweimer, gdeschner, jhrozek, lslebodn, pviktori, sgallagh, ssorce
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Fixed In Version: libtalloc-2.1.11-6.fc28,libtalloc-2.1.11-6.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-02 07:49:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1217376, 1668029    
Bug Blocks: 1539083    

Description Florian Weimer 2018-02-25 10:10:36 UTC
/usr/lib64/libpytalloc-util.cpython-36m-x86-64-linux-gnu.so.2.1.11 in python3-talloc-2.1.11-4.fc28.x86_64 lacks annobin annotations.

This is probably due the use of LTO (bug 1548821).  libldb seems to have a very similar issue (bug 1548822).

Comment 1 Lukas Slebodnik 2018-02-26 09:30:02 UTC
I checked latest build.log

and I can see flto when building with python3 (-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none)

[22/34] Compiling pytalloc_util.c
09:14:03 runner /usr/bin/gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -fPIC -fstack-protector -fvisibility=hidden -MD -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -fno-strict-aliasing -Idefault -I.. -Idefault -I.. -Idefault/lib/replace -I../lib/replace -I/usr/local/include -I/usr/include/python3.6m -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 ../pytalloc_util.c -c -o default/pytalloc_util_18.o

Comment 2 Florian Weimer 2018-02-26 09:35:48 UTC
You could specify CLFAGS/%{optflags} when *linking* with LTO, too.  I expect that should fix the issue.

See https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md for information on RPM macros and environment variables provided by the build environment.

Comment 3 Lukas Slebodnik 2018-02-26 09:54:57 UTC
I would say it is an issue in python3

sh$rpm -q python3

sh$ python3
Python 3.6.4 (default, Feb 16 2018, 15:09:49) 
[GCC 8.0.1 20180210 (Red Hat 8.0.1-0.13)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.sysconfig import get_config_var
>>> get_config_var('LDFLAGS')
'-Wl,-z,relro  -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -Wl,-z,relro  -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none'

Maybe talloc, ldb, and samba use wrong way how to get linked flags for python

Comment 4 Lukas Slebodnik 2018-02-26 15:41:12 UTC
I found a workaround for lto injected by python LDFLAGS.

Samba build system can override with env variable.

diff --git a/libldb.spec b/libldb.spec
index cd72a91..42c03cf 100644
--- a/libtalloc.spec
+++ b/liblalloc.spec
@@ -144,6 +144,9 @@ PY3_CONFIG_FLAGS=--extra-python=%{__python3}
+# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1217376
+export python_LDFLAGS=""
 %configure --disable-rpath \
            --disable-rpath-install \
            --bundled-libraries=NONE \

I you want I can such workaround for libtalloc an libldb.
I do not have permission in samba and I was not able to find similar BZ for samba. But I assume there might be the same issue.

Comment 5 Lukas Slebodnik 2018-03-01 20:17:01 UTC

I did not intentionally applied workaround from previous comment in libldb. Would you like to apply workaround also for libtalloc?

Comment 6 Florian Weimer 2018-03-02 06:00:25 UTC
(In reply to Lukas Slebodnik from comment #5)
> I did not intentionally applied workaround from previous comment in libldb.
> Would you like to apply workaround also for libtalloc?

That would make sense, yes please.  Would you please apply it to Fedora 28 as well?

Comment 7 Lukas Slebodnik 2018-03-02 07:49:08 UTC