You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_crypt segfaults when using libxcrypt instead of libcrypt #76816
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-01-24.13:30:26.894>created_at=<Date2018-01-23.10:22:06.979>labels= ['extension-modules', '3.7']
title='test_crypt segfaults when using libxcrypt instead of libcrypt'updated_at=<Date2021-07-27.21:33:23.914>user='https://github.com/stratakis'
New changeset e768c86 by Victor Stinner (stratakis) in branch 'master': bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (bpo-5284) e768c86
New changeset 6ccdad7 by Victor Stinner (Miss Islington (bot)) in branch '2.7': bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (bpo-5295) 6ccdad7
New changeset 8e230e1 by Victor Stinner (Miss Islington (bot)) in branch '3.6': bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (bpo-5296) 8e230e1
Sorry to bump an old thread, but - does <crypt.h> need to be in the public Python.h header? Or would it be enough to be in _cryptmodule.c, which is the code that uses crypt_r()?
I can provide a quick patch to change that if that seems sound.
Arfrever commented on Jul 26, 2021
Arfrevermannequin
Mannequin
More actions
Geoffrey Thomas:
I agree that including crypt.h only where required is better.
Can you file new bug with patch?
Benjamin Peterson:
I suspect that with crypt.h not included in _cryptmodule.c, crypt() was treated by compiler as implicitly declared function (returning 'int'), however real crypt() function returns 'char*'.
Activity
stratakis commentedon Jan 23, 2018
Currently in Fedora glibc stopped providing libcrypt[0] a change which is slowly being upstreamed as well[1] in favor of the libxcrypt project[2].
This causes a segfault when importing the crypt module as python assumes that crypt.h is always available.
Providing a working patch from the libxcrypt maintainer. I'll convert the patch into a PR.
[0] https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt
[1] https://sourceware.org/ml/libc-alpha/2017-08/msg01257.html
[2] https://github.com/besser82/libxcrypt
vstinner commentedon Jan 23, 2018
New changeset e768c86 by Victor Stinner (stratakis) in branch 'master':
bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (bpo-5284)
e768c86
benjaminp commentedon Jan 24, 2018
Incidentally, why did this manifest as a segfault rather than a compilation error?
vstinner commentedon Jan 24, 2018
Charalampos, Christian: are you ok to backport the fix to Python 2.7 and 3.6? (PR 5295 and PR 5296)
tiran commentedon Jan 24, 2018
yes, go ahead
vstinner commentedon Jan 24, 2018
New changeset 6ccdad7 by Victor Stinner (Miss Islington (bot)) in branch '2.7':
bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (bpo-5295)
6ccdad7
vstinner commentedon Jan 24, 2018
New changeset 8e230e1 by Victor Stinner (Miss Islington (bot)) in branch '3.6':
bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (bpo-5296)
8e230e1
geofft commentedon Jul 21, 2021
Sorry to bump an old thread, but - does <crypt.h> need to be in the public Python.h header? Or would it be enough to be in _cryptmodule.c, which is the code that uses crypt_r()?
I can provide a quick patch to change that if that seems sound.
Arfrever commentedon Jul 26, 2021
Geoffrey Thomas:
I agree that including crypt.h only where required is better.
Can you file new bug with patch?
Benjamin Peterson:
I suspect that with crypt.h not included in _cryptmodule.c, crypt() was treated by compiler as implicitly declared function (returning 'int'), however real crypt() function returns 'char*'.
geofft commentedon Jul 27, 2021
Opened bpo-44751 and #27394 .