This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: (glibc2.28/MIPS32EL) python 3.7.x interpreter segmentation fault (3.6.x/2.7.x compile fine)
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Mariatta, broly
Priority: normal Keywords:

Created on 2018-12-25 19:39 by broly, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg332514 - (view) Author: Gagan (broly) Date: 2018-12-25 19:39
Hello everyone.

I am currently trying to compile Python 3.7.x on a MIPS(el, little endian; 32 bit) platform, and I am having issues producing a functioning interpreter to continue the compilation.

I have no issue compiling either 2.7.x or 3.6.x versions on this machine, and I am using 3.6.7.

here is the dump from the installation:
--------
root@DD-WRT:/mnt/work/Python-3.7.2# make platform
LD_LIBRARY_PATH=/mnt/work/Python-3.7.2:/lib:/usr/lib:/usr/local/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib ./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
	echo "generate-posix-vars failed" ; \
	rm -f ./pybuilddir.txt ; \
	exit 1 ; \
fi
/bin/sh: line 5:   399 Segmentation fault      LD_LIBRARY_PATH=/mnt/work/Python-3.7.2:/lib:/usr/lib:/usr/local/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib ./python -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [Makefile:604: pybuilddir.txt] Error 1
-----------

and here is the valgrind output.:

-----
root@DD-WRT:/mnt/work/Python-3.7.2# valgrind ./python -E -S -m sysconfig --generate-posix-vars
==1246== Memcheck, a memory error detector
==1246== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1246== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1246== Command: ./python -E -S -m sysconfig --generate-posix-vars
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x401FAF4: ??? (in /lib/ld-2.28.so)
==1246==    by 0x400942C: ??? (in /lib/ld-2.28.so)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4020104: ??? (in /lib/ld-2.28.so)
==1246==    by 0x4020024: ??? (in /lib/ld-2.28.so)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4007E94: ??? (in /lib/ld-2.28.so)
==1246==    by 0x4007DC4: ??? (in /lib/ld-2.28.so)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4020104: ??? (in /lib/ld-2.28.so)
==1246==    by 0x400D950: ??? (in /lib/ld-2.28.so)
==1246== 
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D15A8C: pymain_wstrdup (main.c:501)
==1246==    by 0x4D15A8C: pymain_init_cmdline_argv (main.c:561)
==1246==    by 0x4D15A8C: pymain_read_conf (main.c:2024)
==1246==    by 0x4D15A8C: pymain_cmdline_impl (main.c:2642)
==1246==    by 0x4D15A8C: pymain_cmdline (main.c:2707)
==1246==    by 0x4D15A8C: pymain_init (main.c:2748)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D0D688: copy_wstrlist (main.c:1237)
==1246==    by 0x4D171E0: pymain_init_core_argv (main.c:1263)
==1246==    by 0x4D171E0: pymain_read_conf_impl (main.c:1955)
==1246==    by 0x4D171E0: pymain_read_conf (main.c:2028)
==1246==    by 0x4D171E0: pymain_cmdline_impl (main.c:2642)
==1246==    by 0x4D171E0: pymain_cmdline (main.c:2707)
==1246==    by 0x4D171E0: pymain_init (main.c:2748)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D0D688: copy_wstrlist (main.c:1237)
==1246==    by 0x4D17B78: pymain_cmdline_impl (main.c:2663)
==1246==    by 0x4D17B78: pymain_cmdline (main.c:2707)
==1246==    by 0x4D17B78: pymain_init (main.c:2748)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D11C3C: _PyCoreConfig_Copy (main.c:2415)
==1246==    by 0x4C9D630: _Py_InitializeCore (pylifecycle.c:847)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D0D688: copy_wstrlist (main.c:1237)
==1246==    by 0x4D11C9C: _PyCoreConfig_Copy (main.c:2417)
==1246==    by 0x4C9D630: _Py_InitializeCore (pylifecycle.c:847)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Conditional jump or move depends on uninitialised value(s)
==1246==    at 0x4858AEC: wcslen (vg_replace_strmem.c:1856)
==1246==    by 0x4A51CEC: _PyMem_RawWcsdup (obmalloc.c:569)
==1246==    by 0x4D11C3C: _PyCoreConfig_Copy (main.c:2415)
==1246==    by 0x4C9C910: _Py_InitializeCore_impl (pylifecycle.c:711)
==1246==    by 0x4C9D820: _Py_InitializeCore (pylifecycle.c:859)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==    by 0x4D1AE04: _Py_UnixMain (main.c:2822)
==1246==    by 0x400D88: main (in /tmp/mnt/work/Python-3.7.2/python)
==1246== 
==1246== Invalid read of size 4
==1246==    at 0x4A4A864: address_in_range (obmalloc.c:1338)
==1246==    by 0x4A4A864: pymalloc_free.isra.0 (obmalloc.c:1610)
==1246==    by 0x4A4BBF8: _PyObject_Free (obmalloc.c:1815)
==1246==    by 0x4A4B160: PyObject_Free (obmalloc.c:640)
==1246==    by 0x4A08E04: dictresize (dictobject.c:1196)
==1246==    by 0x4A0C66C: insertion_resize (dictobject.c:994)
==1246==    by 0x4A0C66C: insertdict (dictobject.c:1038)
==1246==    by 0x4A0D084: PyDict_SetItem (dictobject.c:1463)
==1246==    by 0x4A946A0: add_operators (typeobject.c:7428)
==1246==    by 0x4A946A0: PyType_Ready (typeobject.c:5188)
==1246==    by 0x4A3D954: _Py_ReadyTypes (object.c:1713)
==1246==    by 0x4C9CA20: _Py_InitializeCore_impl (pylifecycle.c:733)
==1246==    by 0x4C9D820: _Py_InitializeCore (pylifecycle.c:859)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==    by 0x4D18BA0: pymain_main (main.c:2782)
==1246==  Address 0x58f3010 is 8 bytes before a block of size 1,168 alloc'd
==1246==    at 0x484C740: malloc (vg_replace_malloc.c:299)
==1246==    by 0x4A4BFA8: PyMem_RawMalloc (obmalloc.c:503)
==1246==    by 0x4A4FF80: _PyObject_Malloc (obmalloc.c:1560)
==1246==    by 0x4A4B484: PyObject_Malloc (obmalloc.c:616)
==1246==    by 0x4A07B34: new_keys_object (dictobject.c:534)
==1246==    by 0x4A085C8: dictresize (dictobject.c:1141)
==1246==    by 0x4A0C66C: insertion_resize (dictobject.c:994)
==1246==    by 0x4A0C66C: insertdict (dictobject.c:1038)
==1246==    by 0x4A0D084: PyDict_SetItem (dictobject.c:1463)
==1246==    by 0x4A946A0: add_operators (typeobject.c:7428)
==1246==    by 0x4A946A0: PyType_Ready (typeobject.c:5188)
==1246==    by 0x4A3D920: _Py_ReadyTypes (object.c:1710)
==1246==    by 0x4C9CA20: _Py_InitializeCore_impl (pylifecycle.c:733)
==1246==    by 0x4C9D820: _Py_InitializeCore (pylifecycle.c:859)
==1246== 
==1246== Invalid read of size 4
==1246==    at 0x4C51A9C: PyErr_SetObject (errors.c:89)
==1246==    by 0x4C52394: PyErr_FormatV (errors.c:837)
==1246==    by 0x4C525B0: PyErr_Format (errors.c:852)
==1246==    by 0x4AB6E8C: find_maxchar_surrogates (unicodeobject.c:1637)
==1246==    by 0x4AE3D74: PyUnicode_FromWideChar (unicodeobject.c:2045)
==1246==    by 0x4AE5CD0: unicode_decode_locale (unicodeobject.c:3610)
==1246==    by 0x4B1C3BC: PyUnicode_DecodeFSDefaultAndSize (unicodeobject.c:3658)
==1246==    by 0x4CED434: PyThread_GetInfo (thread.c:216)
==1246==    by 0x4CE1C04: _PySys_BeginInit (sysmodule.c:2414)
==1246==    by 0x4C9CCE8: _Py_InitializeCore_impl (pylifecycle.c:753)
==1246==    by 0x4C9D820: _Py_InitializeCore (pylifecycle.c:859)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==  Address 0x54 is not stack'd, malloc'd or (recently) free'd
==1246== 
==1246== 
==1246== Process terminating with default action of signal 11 (SIGSEGV)
==1246==  Access not within mapped region at address 0x54
==1246==    at 0x4C51A9C: PyErr_SetObject (errors.c:89)
==1246==    by 0x4C52394: PyErr_FormatV (errors.c:837)
==1246==    by 0x4C525B0: PyErr_Format (errors.c:852)
==1246==    by 0x4AB6E8C: find_maxchar_surrogates (unicodeobject.c:1637)
==1246==    by 0x4AE3D74: PyUnicode_FromWideChar (unicodeobject.c:2045)
==1246==    by 0x4AE5CD0: unicode_decode_locale (unicodeobject.c:3610)
==1246==    by 0x4B1C3BC: PyUnicode_DecodeFSDefaultAndSize (unicodeobject.c:3658)
==1246==    by 0x4CED434: PyThread_GetInfo (thread.c:216)
==1246==    by 0x4CE1C04: _PySys_BeginInit (sysmodule.c:2414)
==1246==    by 0x4C9CCE8: _Py_InitializeCore_impl (pylifecycle.c:753)
==1246==    by 0x4C9D820: _Py_InitializeCore (pylifecycle.c:859)
==1246==    by 0x4D150D4: pymain_init (main.c:2760)
==1246==  If you believe this happened as a result of a stack
==1246==  overflow in your program's main thread (unlikely but
==1246==  possible), you can try to increase the size of the
==1246==  main thread stack using the --main-stacksize= flag.
==1246==  The main thread stack size used in this run was 8388608.
==1246== 
==1246== HEAP SUMMARY:
==1246==     in use at exit: 40,028 bytes in 100 blocks
==1246==   total heap usage: 197 allocs, 97 frees, 60,589 bytes allocated
==1246== 
==1246== LEAK SUMMARY:
==1246==    definitely lost: 0 bytes in 0 blocks
==1246==    indirectly lost: 0 bytes in 0 blocks
==1246==      possibly lost: 0 bytes in 0 blocks
==1246==    still reachable: 40,028 bytes in 100 blocks
==1246==         suppressed: 0 bytes in 0 blocks
==1246== Rerun with --leak-check=full to see details of leaked memory
==1246== 
==1246== For counts of detected and suppressed errors, rerun with: -v
==1246== Use --track-origins=yes to see where uninitialised values come from
==1246== ERROR SUMMARY: 45 errors from 12 contexts (suppressed: 0 from 0)
Segmentation fault
------

it seems to me there is an issue with the new Modules/getpath.c Objects/pathconfig.c Modules/main.c compared to the 3.6.x versions?

Any help would be appreciated! 

thank you
msg332570 - (view) Author: Gagan (broly) Date: 2018-12-27 00:35
i tried compiling using "--without-pymalloc" and experienced the same problem.

there is no REASONABLE explanation for how this anomaly has arisen within SUBVERSIONS.

in the words of some infamous rappers:

"what, the 'embedded' (ARM-fellating) [east coast] crew doesn't have any love for MIPS [{Dr.} Dre and Snoop Dogg]?" (https://www.youtube.com/watch?v=tNfx325Nw78)

"y'all don't love MIPS (us)?"

"well let it be known then. we know you're ARM lovers ('east coast')"

seems those "high minded", "ancient", "lost civilisation" (and "aryan" [LULZ]) individuals have polluted computing.

it is unreal how much you guys have destroyed your own language.
msg332603 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-12-27 17:23
Your disrespectful comments and insults are not welcome here.
msg332605 - (view) Author: Gagan (broly) Date: 2018-12-27 17:45
of course you have more time to get sanctimonious than provide a substantive or insight comment as to what the problem is.

i am not surprised, at all.
msg332728 - (view) Author: Gagan (broly) Date: 2018-12-29 17:56
hello everyone.

the core problem was that the 3.x series configure file includes a "-lintl" flag when it discovers the libintl header. in 2.x, this was not the case.

so when configure is checking for wchar_t, the inclusion of -lintl (as opposed to libgnuintl, which is what i have), it fails and returns 0 which is then the SIZEOF_WCHAR_T in the pyconfig.h file.

it turns out Modules/main.c relies more on wchar_t in 3.7 than it does in 3.6.x, which is why i did not see this problem arise when compiling the interpreter to complete module compilation (and tests).

however, in 3.7.x, there is additional use of wchar_t and thus the segmentation faults (allocating 0 bytes).

hope this helps others who may compile the GNU flavour of libintl (see https://lists.gnu.org/archive/html/bug-gnu-utils/2010-07/msg00002.html for more information. i learned a little too).

CHEERS EH
History
Date User Action Args
2022-04-11 14:59:09adminsetgithub: 79764
2018-12-30 01:09:46brolysetresolution: not a bug -> rejected
2018-12-29 17:56:32brolysetstatus: open -> closed
resolution: not a bug
messages: + msg332728

stage: resolved
2018-12-27 17:45:42brolysetmessages: + msg332605
2018-12-27 17:23:45Mariattasetnosy: + Mariatta
messages: + msg332603
2018-12-27 00:35:53brolysetmessages: + msg332570
2018-12-25 19:40:24brolysettitle: python 3.7.x interpreter segmentation fault (3.6.x/2.7.x compile fine) -> (glibc2.28/MIPS32EL) python 3.7.x interpreter segmentation fault (3.6.x/2.7.x compile fine)
2018-12-25 19:39:03brolycreate