[issue45700] Got SEGV in compilation python3.6 with GCC-11, and please renewal python3.6.

2021-11-03 Thread Ned Deily


Ned Deily  added the comment:

As you note, Python 3.6 is almost at end-of-life, in fewer than two months from 
now. And, in any case, it is in the security-fix-only phase of its life cycle 
so changes just to support OS platform or build tool updates are out-of-scope 
in general, not to mention anything that might cause an ABI or API change. 
Thanks for the suggestion and documenting workarounds, though!

--
nosy: +ned.deily
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45700] Got SEGV in compilation python3.6 with GCC-11, and please renewal python3.6.

2021-11-03 Thread Nojima Takahide


New submission from Nojima Takahide :

I found python3.6.15(latest) caused SEGV while installing it using pyenv with 
GCC-11 on Debian sid. I show the Error below,

---here---
$ pyenv install -k 3.6.15
Downloading Python-3.6.15.tar.xz...
-> https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tar.xz
Installing Python-3.6.15...

BUILD FAILED (Debian unstable using python-build 2.1.0-12-g5963dc4f)

Inspect or clean up the working tree at ~/.anyenv/envs/pyenv/sources/3.6.15
Results logged to /tmp/python-build.20211103135942.18999.log

Last 10 log lines:
if test "xupgrade" != "xno"  ; then \
case upgrade in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
 ./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Segmentation fault
make: *** [Makefile:1102: install] Error 139
$ gcc -v
...snip...
gcc version 11.2.0 (Debian 11.2.0-10) 
--Here

This root cause is the same as bpo-27987. In the case of python 3.6.15, the 
"gcc-11 -O3" applies "movaps" against the non-16bytes alignment address of 
"PyObject."  I show this clue as below,

--Here---
$ gdb --args ./python -m ensurepip
(gdb) run
Program received signal SIGSEGV, Segmentation fault.
0x76be957e in PyCFuncPtr_new (type=0x55c3cde8, args=0x76c6c630, 
kwds=0x0)
at 
~/.anyenv/envs/pyenv/sources/3.6.15/Python-3.6.15/Modules/_ctypes/_ctypes.c:3557
3557self->thunk = thunk;
(gdb) disas PyCFuncPtr_new
   ...snip
   0x76be955d <+221>:   je 0x76be98a0 
   0x76be9563 <+227>:   mov0x78(%rsp),%rax
   0x76be9568 <+232>:   movq   %r15,%xmm0
   0x76be956d <+237>:   movq   %rax,%xmm1
   0x76be9572 <+242>:   addq   $0x1,(%rax)
   0x76be9576 <+246>:   mov0x10(%r13),%rax
   0x76be957a <+250>:   punpcklqdq %xmm1,%xmm0
   0x76be957e <+254>:   movaps %xmm0,0x60(%r13) ;<- cause SEGV
   0x76be9583 <+259>:   mov0x20(%r15),%rdx
   0x76be9587 <+263>:   mov%rdx,(%rax)

Checking %r13 at "movaps",it has non-16bytes alignment address as its value.
--Here--

 Then, I would much appriciate if someone does ``cherry-pick`` the following 2 
commits of github.com/python/cpython to its branch 3.6,  
  - 8766cb74e186d3820db0a855ccd780d6d84461f7 
  - f0be4bbb9b3cee876249c23f2ae6f38f43fa7495
and please releases the newer python3.6. I already apply and tested this in my 
Debian box and I confirmed  it to solve this problem.

Thanks.

 Note: For someone who met the same problem, I show two tiny workarounds as 
below, if no one can release the newer python3.6 with this remedy, because of 
near the end of life of 3.6.

Workaround1: Use GCC version 10. The GCC-10 seems not to have this problem.
 command: env CC=gcc-10 pyenv install 3.6.15

Workaround2: Use -O2 level with GCC-11. The "-O2" seems to skip the vectorize 
optimization so that GCC doesn't apply "movaps" at all. As a result, it can 
avoid this problem.
 command: env CFLAGS=-O2 pyenv install 3.6.15
---
Takahide Nojima

--
components: Installation
messages: 405588
nosy: Nojima Takahide
priority: normal
severity: normal
status: open
title: Got SEGV in compilation python3.6 with GCC-11, and please renewal 
python3.6.
type: crash
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com