Bug 251637 - PATCH: fix ctypes requireing an executabel stack
PATCH: fix ctypes requireing an executabel stack
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: python (Show other bugs)
11
All Linux
low Severity low
: ---
: ---
Assigned To: Dave Malcolm
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-10 04:27 EDT by Hans de Goede
Modified: 2009-11-08 03:21 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-11-08 03:21:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
PATCH: fix ctypes requireing an executable stack (1.87 KB, patch)
2007-08-10 05:11 EDT, Hans de Goede
no flags Details | Diff

  None (edit)
Description Hans de Goede 2007-08-10 04:27:35 EDT
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 04:37:58 EDT
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 05:12:00 EDT
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 10:13:31 EDT
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 14:47:12 EDT
(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 16:24:01 EST
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 05:17:17 EDT
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 18:12:28 EST
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 03:21:12 EST
[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.

Note You need to log in before you can comment on or make changes to this bug.