Bug 1198161

Summary: SEGV due to -Xlinker -export-dynamic [wait for Python 3.7.4]
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: python3Assignee: Victor Stinner <vstinner>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 30CC: abokovoy, asn, dave.booth, extras-qa, gbenson, gdeschner, jan.kratochvil, jberan, jlayton, madam, mhroncok, palves, pviktori, sbose, sergiodj, ssorce, tomspur, vstinner
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: i686   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/71b890ea2fdf79263cf4f1f4d430985cdd4a0a26
Whiteboard: abrt_hash:717f8ce747e0f26a850459532b445d59bd0344e4
Fixed In Version: python3-3.7.4-1.fc30 python3-3.7.4-1.fc29 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1198158 Environment:
Last Closed: 2019-07-29 01:08:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1197914, 1198158    
Bug Blocks:    

Description Jan Kratochvil 2015-03-03 13:34:05 UTC
+++ This bug was initially created as a clone of Bug #1198158 +++

+++ This bug was initially created as a clone of Bug #1197914 +++

crash on:

Truncated backtrace:
Thread no. 1 (10 frames)
 #0 timeval_add at ../../libiberty/timeval-utils.c:56
    ^^^^^^^^^^^ = from /usr/bin/gdb
 #1 timeval_current_ofs at ../lib/util/time.c:588
    ^^^^^^^^^^^ = from samba-libs called due to undefined timeval_add
 #2 name_query at ../source3/libsmb/namequery.c:1505
 #3 lookup_byname_backend at ../nsswitch/wins.c:103
 #4 _nss_wins_gethostbyname_r at ../nsswitch/wins.c:303
 #5 __gethostbyname_r at ../nss/getXXbyYY_r.c:266
 #6 gethostbyname at ../nss/getXXbyYY.c:116

This is because GDB is linked with -rdynamic.  This is wrong due to:
$ python3-config --ldflags
 -L/usr/lib64 -lpthread -ldl  -lutil -lm  -lpython3.4m -Xlinker -export-dynamic
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^

/usr/lib64/libsamba-util.so.0:
000000321ac0f960 T timeval_add
/usr/lib64/libsamba-util.so.0.0.1:
000000321ac0f960 T timeval_add
/usr/lib64/libsmbldap.so.0:
                 U timeval_add
/usr/lib64/samba/libcli-nbt.so:
                 U timeval_add
/usr/lib64/samba/libcli_cldap.so:
                 U tevent_timeval_add
/usr/lib64/samba/libsmbd_base.so:
                 U timeval_add

Samba should not depend on such a generic symbol but that is Bug 1198158.

The crash Bug 1197914 happened for python(=2).fc21 but I have checked python*-config is still wrong in python3-devel.

Comment 1 Fedora Admin XMLRPC Client 2015-05-12 12:02:28 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Jan Kurik 2015-11-04 17:19:56 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Jan Kratochvil 2015-11-13 18:01:15 UTC
python3-devel-3.4.3-5.fc24.x86_64

Comment 4 Fedora Admin XMLRPC Client 2016-01-29 13:07:06 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Jan Kurik 2016-02-24 13:21:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 6 Jan Kurik 2017-07-26 02:05:31 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Jan Kurik 2017-08-08 19:54:18 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 8 Petr Viktorin (pviktori) 2017-08-09 08:46:19 UTC
I don't think this was fixed, and I'd still like to get around to investigating it.

Comment 9 Pedro Alves 2017-08-09 09:43:41 UTC
See here:
  https://sourceware.org/bugzilla/show_bug.cgi?id=16881

It has references to further discussions, to the corresponding upstream GDB bug, and to the GDB workaround currently in place.  So this should be fixed nowadays, but I haven't double checked which Fedora version started carrying the fix.

I'd be nice if libwins_nss.so were fixed to avoid poluting the namespace, as per the referenced discussions.  If you google for timeval_add, you'll see this doesn't affect just GDB.  E.g.:
  https://blog.schmichael.com/2006/11/29/mdns-crashes-samba/

Comment 10 Jan Kurik 2017-08-15 08:44:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 11 Ben Cotton 2018-11-27 18:31:38 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Petr Viktorin (pviktori) 2019-01-07 13:10:43 UTC
Setting this to low priority.

It would be great if someone else would get to this earlier than we can. If that's your case, please assign the bug to yourself (and adjust priority accordingly).

Comment 13 Ben Cotton 2019-02-19 17:11:49 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 14 Victor Stinner 2019-03-19 14:07:26 UTC
This issue is open since 2015... Is it still up to date? It's unclear to me if the issue is really on Python side or on Samba side...

Can we close this issue if there is no activity from the reporter?

Jan: Can you still reproduce the issue on Fedora 29?

Comment 15 Jan Kratochvil 2019-03-19 14:41:57 UTC
The bug is definitely on Python side:

python3-devel-3.7.2-4.fc29.x86_64
$ python3-config --ldflags
 -L/usr/lib64 -lpython3.7m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic

Linking some one shared library should not affect how the main executable is linked.

It will no longer crash GDB as GDB has now some ugly workaround to remove that -export-dynamic:
  https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=a4a1c15754d144d14dc48cd8ff62601f977e908c

Also the upstream Bug is still open:
  Use -Wl,--dynamic-list=x.list, not -Xlinker -export-dynamic
  https://bugs.python.org/issue10112

Comment 16 Victor Stinner 2019-03-21 14:58:07 UTC
Does someone know if https://fedoraproject.org/wiki/Changes/Python_Extension_Flags change will help or fix this issue?

Comment 17 Jan Kratochvil 2019-03-21 15:10:01 UTC
(In reply to Victor Stinner from comment #16)
> Does someone know if
> https://fedoraproject.org/wiki/Changes/Python_Extension_Flags change will
> help or fix this issue?

Is that "-Xlinker -export-dynamic" present in upstream build of Python?  I think it is (I haven't verified it) so then the Python_Extension_Flags change would be unrelated.

Comment 18 Victor Stinner 2019-04-02 15:10:19 UTC
> Is that "-Xlinker -export-dynamic" present in upstream build of Python?

The flag comes from LINKFORSHARED variable and it's defined as "-Xlinker -export-dynamic" by configure.ac. So yes, the flag comes from upstream.

> Does someone know if https://fedoraproject.org/wiki/Changes/Python_Extension_Flags change will help or fix this issue?

I checked the code of Python and I can now say: no, this change isn't going to fix this issue.

This issue is able python-config script, whereas https://fedoraproject.org/wiki/Changes/Python_Extension_Flags is able distutils and sysconfig modules of the Python stdlib.

I created https://bugs.python.org/issue36508 to propose to modifiy python-config --ldflags to no longer includes LINKFORSHARED ("-Xlinker -export-dynamic" on Linux).

I checked Python source code and the "ld" manual page and it seems like -export-dynamic must only be used for executables, like building "python" executable. This linker flag must not be exported by python-config.

Comment 19 Victor Stinner 2019-04-09 17:23:12 UTC
I just pushed a fix upstream in the future Python 3.8:

New changeset e65f01f78d7bda3013fc5be485afa87ff56511d9 by Victor Stinner in branch 'master':
bpo-36508: python-config don't export LINKFORSHARED (GH-12661)
https://github.com/python/cpython/commit/e65f01f78d7bda3013fc5be485afa87ff56511d9

Comment 20 Miro HronĨok 2019-04-16 13:07:01 UTC
This will be fixed in the next 3.8 and 3.7 release. Let us know if you need it sooner than that.

Comment 21 Fedora Update System 2019-07-23 13:09:16 UTC
FEDORA-2019-9bfb4a3e4b has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-9bfb4a3e4b

Comment 22 Fedora Update System 2019-07-23 13:09:32 UTC
FEDORA-2019-60a1defcd1 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-60a1defcd1

Comment 23 Fedora Update System 2019-07-29 01:08:01 UTC
python3-3.7.4-1.fc30, python3-docs-3.7.4-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 24 Fedora Update System 2019-08-05 01:40:56 UTC
python3-3.7.4-1.fc29, python3-docs-3.7.4-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.