Bug 251637

Summary: PATCH: fix ctypes requireing an executabel stack
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: pythonAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 11CC: christian.joensson, dmalcolm, mebrown
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-08 08:21:12 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:
Attachments:
Description Flags
PATCH: fix ctypes requireing an executable stack none

Description Hans de Goede 2007-08-10 08:27:35 UTC
ctypes claims to require an executabel stack, causing ctypes using modules to
fail (when selinux is enabled as it is by default):

[hans@shalem ~]$ python
Python 2.5.1 (r251:54863, Jun 27 2007, 11:06:53) 
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenGL.GL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/OpenGL/GL/__init__.py", line 2, in <module>
    from OpenGL.raw.GL import *
  File "/usr/lib/python2.5/site-packages/OpenGL/raw/GL/__init__.py", line 6, in
<module>
    from OpenGL.raw.GL.constants import *
  File "/usr/lib/python2.5/site-packages/OpenGL/raw/GL/constants.py", line 6, in
<module>
    from ctypes import *
  File "/usr/lib64/python2.5/ctypes/__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /usr/lib64/python2.5/lib-dynload/_ctypes.so: cannot enable
executable stack as shared object requires: Permission denied
>>>

Doing "sudo execstack -c /usr/lib64/python2.5/lib-dynload/_ctypes.so" fixes this 
and for example glchess which uses ctypes extensively through PyOpenGL works
fine, so the claiming of the need for an executable stack is false (as it
usually is).

I'll see if I can find the cause for the false claim of the need for an
executable stack.

Comment 1 Hans de Goede 2007-08-10 08:37:58 UTC
I think I've found the cause, and I believe this only happens on x86_64 (and
maybe ppc). I'm currently running a compile with a patch I wrote to see if this
patch fixes it. To be continued.



Comment 2 Hans de Goede 2007-08-10 09:12:00 UTC
Created attachment 161041 [details]
PATCH: fix ctypes requireing an executable stack

I can confirm that the attached patch fixes it, and I'm pretty sure ppc and
ppc64 will have this bug too, I've made the patch so that it should fix them
too.

Comment 3 Jeremy Katz 2007-08-10 14:13:31 UTC
Indeed -- we had this patch in F7, but upstream had said they included it in
2.5.1.  *sigh*  Thanks Hans, added and building

Comment 4 Hans de Goede 2007-08-10 18:47:12 UTC
(In reply to comment #3)
> Indeed -- we had this patch in F7, but upstream had said they included it in
> 2.5.1.  *sigh*  Thanks Hans, added and building

Well, the nescesarry gnu-stack section was already present in the i386 asm, so
maybe upstream only fixed it there.


Comment 5 Michael E Brown 2009-02-17 21:24:01 UTC
Is it possible that this regressed in current Rawhide? I have BZ# 481453 opened against libsmbios, which I think is caused by ctypes requiring execmem. Libsmbios itself doesnt require execmem.

Comment 6 Bug Zapper 2009-06-09 09:17:17 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Dave Malcolm 2009-11-06 23:12:28 UTC
Sorry about the lack of activity on this bug.

Are you still able to reproduce it?

I don't see it on this machine (albeit 32-bit F11 with a locally-rebuilt rawhide SRPM of python, maybe arch-specific?):
[david@brick show]$ python
Python 2.6.4 (r264:75706, Oct 29 2009, 22:44:06) 
[GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenGL.GL
>>> 

[david@brick show]$ /usr/sbin/getenforce 
Enforcing

[david@brick show]$ execstack -q /usr/lib/python2.6/lib-dynload/_ctypes.so
- /usr/lib/python2.6/lib-dynload/_ctypes.so

(i.e. execstack not requested by the DSO)

Comment 8 Hans de Goede 2009-11-08 08:21:12 UTC
[hans@localhost anaconda]$ execstack -q /usr/lib64/python2.6/lib-dynload/_ctypes.so

F-12 x86_64:
- /usr/lib64/python2.6/lib-dynload/_ctypes.so

F-11 x86_64:
- /usr/lib64/python2.6/lib-dynload/_ctypes.so

So this bug is no longer present, closing.