FS#52709 - [linux-grsec] segfault on grsec when importing python-requests

Attached to Project: Community Packages
Opened by kpcyrd (kpcyrd) - Wednesday, 25 January 2017, 12:02 GMT
Last edited by Daniel Micay (thestinger) - Wednesday, 25 January 2017, 17:20 GMT
Task Type Support Request
Category Packages
Status Closed
Assigned To Daniel Micay (thestinger)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

Description:
python started segfaulting for me on grsec due to RWX mmap when importing python-requests. Not sure if this is python or python-requests related. This limits usability of my system since I'm relying on python-requests. :)

Additional info:
python: Version : 3.6.0-2
python-requests: Version : 2.12.5-1

$ python
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Segmentation fault (core dumped)
$


kernel: grsec: denied RWX mmap of <anonymous mapping> by /usr/bin/python3.6[python:31241] uid/euid:1000/1000 gid/egid:1000/1000, parent /usr/bin/bash[bash:31221] uid/euid:1000/1000 gid/egid:1000/1000
kernel: grsec: denied RWX mmap of <anonymous mapping> by /usr/bin/python3.6[python:31241] uid/euid:1000/1000 gid/egid:1000/1000, parent /usr/bin/bash[bash:31221] uid/euid:1000/1000 gid/egid:1000/1000
kernel: python[31241]: segfault at 0 ip 000003aeb9522d9b sp 000003d430aecfb8 error 6 in libffi.so.6.0.4[3aeb951d000+7000]
systemd[1]: Started Process Core Dump (PID 31244/UID 0).
systemd-coredump[31245]: Process 31241 (python) of user 1000 dumped core.

Stack trace of thread 31241:
#0 0x000003aeb9522d9b ffi_prep_closure_loc (libffi.so.6)
#1 0x000003aeb7beea6f n/a (_cffi_backend.cpython-36m-x86_64-linux-gnu.so)
#2 0x000003aeb7beed9b n/a (_cffi_backend.cpython-36m-x86_64-linux-gnu.so)
#3 0x000003aebd175995 _PyCFunction_FastCallDict (libpython3.6m.so.1.0)
#4 0x000003aebd184a0f n/a (libpython3.6m.so.1.0)
#5 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#6 0x000003aebd1836ff n/a (libpython3.6m.so.1.0)
#7 0x000003aebd18478a n/a (libpython3.6m.so.1.0)
#8 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#9 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#10 0x000003aebd184f47 PyEval_EvalCodeEx (libpython3.6m.so.1.0)
#11 0x000003aebd140a5b PyEval_EvalCode (libpython3.6m.so.1.0)
#12 0x000003aebd138778 n/a (libpython3.6m.so.1.0)
#13 0x000003aebd175d00 PyCFunction_Call (libpython3.6m.so.1.0)
#14 0x000003aebd146379 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#15 0x000003aebd183291 n/a (libpython3.6m.so.1.0)
#16 0x000003aebd18478a n/a (libpython3.6m.so.1.0)
#17 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#18 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#19 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#20 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#21 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#22 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#23 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#24 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#25 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#26 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#27 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#28 0x000003aebd183f9a _PyFunction_FastCallDict (libpython3.6m.so.1.0)
#29 0x000003aebd1d9a4e _PyObject_FastCallDict (libpython3.6m.so.1.0)
#30 0x000003aebd1da45a _PyObject_CallMethodIdObjArgs (libpython3.6m.so.1.0)
#31 0x000003aebd12c084 PyImport_ImportModuleLevelObject (libpython3.6m.so.1.0)
#32 0x000003aebd14328d _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#33 0x000003aebd184f47 PyEval_EvalCodeEx (libpython3.6m.so.1.0)
#34 0x000003aebd140a5b PyEval_EvalCode (libpython3.6m.so.1.0)
#35 0x000003aebd138778 n/a (libpython3.6m.so.1.0)
#36 0x000003aebd175d00 PyCFunction_Call (libpython3.6m.so.1.0)
#37 0x000003aebd146379 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#38 0x000003aebd183291 n/a (libpython3.6m.so.1.0)
#39 0x000003aebd18478a n/a (libpython3.6m.so.1.0)
#40 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#41 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#42 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#43 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#44 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#45 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#46 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#47 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#48 0x000003aebd18453a n/a (libpython3.6m.so.1.0)
#49 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)
#50 0x000003aebd140d77 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#51 0x000003aebd183f9a _PyFunction_FastCallDict (libpython3.6m.so.1.0)
#52 0x000003aebd1d9a4e _PyObject_FastCallDict (libpython3.6m.so.1.0)
#53 0x000003aebd1da45a _PyObject_CallMethodIdObjArgs (libpython3.6m.so.1.0)
#54 0x000003aebd12c084 PyImport_ImportModuleLevelObject (libpython3.6m.so.1.0)
#55 0x000003aebd14328d _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#56 0x000003aebd184f47 PyEval_EvalCodeEx (libpython3.6m.so.1.0)
#57 0x000003aebd140a5b PyEval_EvalCode (libpython3.6m.so.1.0)
#58 0x000003aebd138778 n/a (libpython3.6m.so.1.0)
#59 0x000003aebd175d00 PyCFunction_Call (libpython3.6m.so.1.0)
#60 0x000003aebd146379 _PyEval_EvalFrameDefault (libpython3.6m.so.1.0)
#61 0x000003aebd183291 n/a (libpython3.6m.so.1.0)
#62 0x000003aebd18478a n/a (libpython3.6m.so.1.0)
#63 0x000003aebd184af3 n/a (libpython3.6m.so.1.0)

Steps to reproduce:
- Run grsec kernel
- Install python and python-requests
- python -c 'import requests'
This task depends upon

Closed by  Daniel Micay (thestinger)
Wednesday, 25 January 2017, 17:20 GMT
Reason for closing:  Not a bug
Comment by Daniel Micay (thestinger) - Wednesday, 25 January 2017, 17:19 GMT
Your steps to reproduce are incomplete. PaX soft mode is enabled by default, so the kernel self protection features are all active but not the userspace mitigation features. PaX soft mode is disabled if you install paxd, but paxd makes an MPROTECT exception for python3.

This is not a bug, it's a missing exception, perhaps because you disabled PaX soft mode on your own without paxd.

Loading...