- Use system libffi
- Resolves: bug#490573 - Fix SELinux execmem problems - Resolves: bug#488396
This commit is contained in:
parent
bf04731dee
commit
46f141e104
|
@ -0,0 +1,85 @@
|
|||
diff -ur Python-2.6~/Modules/_ctypes/callbacks.c Python-2.6/Modules/_ctypes/callbacks.c
|
||||
--- Python-2.6~/Modules/_ctypes/callbacks.c 2008-06-09 00:58:54.000000000 -0400
|
||||
+++ Python-2.6/Modules/_ctypes/callbacks.c 2009-03-17 00:08:38.424528546 -0400
|
||||
@@ -21,8 +21,8 @@
|
||||
Py_XDECREF(self->converters);
|
||||
Py_XDECREF(self->callable);
|
||||
Py_XDECREF(self->restype);
|
||||
- if (self->pcl)
|
||||
- FreeClosure(self->pcl);
|
||||
+ if (self->pcl_write)
|
||||
+ ffi_closure_free(self->pcl_write);
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
@@ -373,7 +373,8 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- p->pcl = NULL;
|
||||
+ p->pcl_exec = NULL;
|
||||
+ p->pcl_write = NULL;
|
||||
memset(&p->cif, 0, sizeof(p->cif));
|
||||
p->converters = NULL;
|
||||
p->callable = NULL;
|
||||
@@ -402,8 +403,9 @@
|
||||
|
||||
assert(CThunk_CheckExact(p));
|
||||
|
||||
- p->pcl = MallocClosure();
|
||||
- if (p->pcl == NULL) {
|
||||
+ p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure),
|
||||
+ &p->pcl_exec);
|
||||
+ if (p->pcl_write == NULL) {
|
||||
PyErr_NoMemory();
|
||||
goto error;
|
||||
}
|
||||
@@ -448,7 +450,9 @@
|
||||
"ffi_prep_cif failed with %d", result);
|
||||
goto error;
|
||||
}
|
||||
- result = ffi_prep_closure(p->pcl, &p->cif, closure_fcn, p);
|
||||
+ result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
|
||||
+ p,
|
||||
+ p->pcl_exec);
|
||||
if (result != FFI_OK) {
|
||||
PyErr_Format(PyExc_RuntimeError,
|
||||
"ffi_prep_closure failed with %d", result);
|
||||
diff -ur Python-2.6~/Modules/_ctypes/_ctypes.c Python-2.6/Modules/_ctypes/_ctypes.c
|
||||
--- Python-2.6~/Modules/_ctypes/_ctypes.c 2008-08-19 15:40:23.000000000 -0400
|
||||
+++ Python-2.6/Modules/_ctypes/_ctypes.c 2009-03-17 00:08:38.479530502 -0400
|
||||
@@ -3438,7 +3438,7 @@
|
||||
self->callable = callable;
|
||||
|
||||
self->thunk = thunk;
|
||||
- *(void **)self->b_ptr = (void *)thunk->pcl;
|
||||
+ *(void **)self->b_ptr = (void *)thunk->pcl_exec;
|
||||
|
||||
Py_INCREF((PyObject *)thunk); /* for KeepRef */
|
||||
if (-1 == KeepRef((CDataObject *)self, 0, (PyObject *)thunk)) {
|
||||
diff -ur Python-2.6~/Modules/_ctypes/ctypes.h Python-2.6/Modules/_ctypes/ctypes.h
|
||||
--- Python-2.6~/Modules/_ctypes/ctypes.h 2008-07-24 07:16:45.000000000 -0400
|
||||
+++ Python-2.6/Modules/_ctypes/ctypes.h 2009-03-17 00:08:38.480528344 -0400
|
||||
@@ -95,7 +95,8 @@
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD
|
||||
- ffi_closure *pcl; /* the C callable */
|
||||
+ ffi_closure *pcl_write; /* the C callable, writeable */
|
||||
+ void *pcl_exec; /* the C callable, executable */
|
||||
ffi_cif cif;
|
||||
int flags;
|
||||
PyObject *converters;
|
||||
diff -ur Python-2.6~/setup.py Python-2.6/setup.py
|
||||
--- Python-2.6~/setup.py 2009-03-17 00:07:54.771651851 -0400
|
||||
+++ Python-2.6/setup.py 2009-03-17 00:08:19.792558478 -0400
|
||||
@@ -1701,8 +1701,7 @@
|
||||
'_ctypes/callbacks.c',
|
||||
'_ctypes/callproc.c',
|
||||
'_ctypes/stgdict.c',
|
||||
- '_ctypes/cfield.c',
|
||||
- '_ctypes/malloc_closure.c']
|
||||
+ '_ctypes/cfield.c']
|
||||
depends = ['_ctypes/ctypes.h']
|
||||
|
||||
if sys.platform == 'darwin':
|
|
@ -62,7 +62,7 @@ Patch101: python-2.3.4-lib64-regex.patch
|
|||
Patch102: python-2.6-lib64.patch
|
||||
|
||||
# SELinux patches
|
||||
Patch110: python-2.6-lib64.patch
|
||||
Patch110: python-2.6-ctypes-noexecmem.patch
|
||||
|
||||
# New API from 2.6
|
||||
#Patch260: python-2.5.2-set_wakeup_fd4.patch
|
||||
|
|
Loading…
Reference in New Issue