From: John R. <jr...@Bi...> - 2005-04-20 22:47:30
|
> $ valgrind --tool=memcheck --log-file=log --trace-syscalls=yes \ > python -c 'import ctypes' > > Traceback (most recent call last): > File "<string>", line 1, in ? > File "ctypes/__init__.py", line 13, in ? > from _ctypes import Union, Structure, Array > ImportError: ./_ctypes.so: cannot enable executable stack as shared > object requires: Invalid argument $ execstack --query ./_ctypes.so $( which valgrind ) Note that _ctypes.so probably says '?' ["don't know"] and valgrind probably says '-' ["executable stack not required"]. $ readelf --program-headers ./_ctypes.so $ readelf --program-headers $( which valgrind ) Look at the GNU_STACK line. _ctypes.so probably has none at all, while valrind probably has one that says "RW-" ["executable stack not required" because no 'X' is present]. So, valgrind forgot to put "-W,-z,execstack" in its static link command so as to be usable when an old .so is invoked on a new system where dlopen [and ld-linux.so.2, both of which are components of glibc] and the Linux kernel enforce non-executable stacks. Also, _ctype.so forgot to put "-W,-z,noexecstack" in its static link command, so as to be usable on systems that prefer to enforce non- executable stacks. It might be possible to achieve a "quick fix" via $ execstack --clear-execstack ./_ctype.so [above is preferable] _or_ via [below is last resort] $ execstack --set-execstack $( which valgrind ) assuming you have the necessary filesystem permissions. -- John Reiser, jr...@Bi... |