[ffcall] Clean out prebuilt object files. Add trampoline patch to force use of mmap() to get executable memor

Jerry James jjames at fedoraproject.org
Tue Jan 10 20:02:22 UTC 2012


commit 978f9ba006e3a7f645ac0a432a00140275446d5e
Author: Jerry James <loganjerry at gmail.com>
Date:   Tue Jan 10 13:01:58 2012 -0700

    Clean out prebuilt object files.
    Add trampoline patch to force use of mmap() to get executable memory.

 ffcall-trampoline.patch |   42 ++++++++++++++++++++++++++++++++++++++++++
 ffcall.spec             |   17 ++++++++++++++---
 2 files changed, 56 insertions(+), 3 deletions(-)
---
diff --git a/ffcall-trampoline.patch b/ffcall-trampoline.patch
new file mode 100644
index 0000000..d014f78
--- /dev/null
+++ b/ffcall-trampoline.patch
@@ -0,0 +1,42 @@
+--- ./callback/trampoline_r/trampoline.c.orig	2009-04-27 09:24:05.000000000 -0600
++++ ./callback/trampoline_r/trampoline.c	2012-01-10 12:03:02.752466354 -0700
+@@ -67,10 +67,6 @@ extern void (*tramp_r) (); /* trampoline
+ 
+ #ifndef CODE_EXECUTABLE
+ /* How do we make the trampoline's code executable? */
+-#if defined(HAVE_MACH_VM) || defined(__convex__) || defined(HAVE_WORKING_MPROTECT) || defined(HAVE_SYS_M88KBCS_H)
+-/* mprotect() [or equivalent] the malloc'ed area. */
+-#define EXECUTABLE_VIA_MPROTECT
+-#else
+ #ifdef HAVE_MMAP
+ /* Use an mmap'ed page. */
+ #define EXECUTABLE_VIA_MMAP
+@@ -90,7 +86,6 @@ extern void (*tramp_r) (); /* trampoline
+ #endif
+ #endif
+ #endif
+-#endif
+ 
+ #include <stdio.h> /* declares fprintf() */
+ 
+--- ./trampoline/trampoline.c.orig	2008-09-26 14:19:37.000000000 -0600
++++ ./trampoline/trampoline.c	2012-01-10 12:02:33.027731322 -0700
+@@ -67,10 +67,6 @@ extern void (*tramp) (); /* trampoline p
+ 
+ #ifndef CODE_EXECUTABLE
+ /* How do we make the trampoline's code executable? */
+-#if defined(HAVE_MACH_VM) || defined(__convex__) || defined(HAVE_WORKING_MPROTECT) || defined(HAVE_SYS_M88KBCS_H)
+-/* mprotect() [or equivalent] the malloc'ed area. */
+-#define EXECUTABLE_VIA_MPROTECT
+-#else
+ #ifdef HAVE_MMAP
+ /* Use an mmap'ed page. */
+ #define EXECUTABLE_VIA_MMAP
+@@ -90,7 +86,6 @@ extern void (*tramp) (); /* trampoline p
+ #endif
+ #endif
+ #endif
+-#endif
+ 
+ #include <stdio.h> /* declares fprintf() */
+ 
diff --git a/ffcall.spec b/ffcall.spec
index 969d604..b062553 100644
--- a/ffcall.spec
+++ b/ffcall.spec
@@ -2,7 +2,7 @@
 
 Name:           ffcall
 Version:        1.10
-Release:        6.20100903cvs%{?dist}
+Release:        7.20100903cvs%{?dist}
 Summary:        Libraries for foreign function call interfaces
 
 Group:          System Environment/Libraries
@@ -14,6 +14,9 @@ URL:            http://www.gnu.org/software/libffcall/
 #       export -D 2010-09-04 ffcall
 #   tar cJf ffcall-20100903cvs.tar.xz ffcall
 Source0:        ffcall-20100903cvs.tar.xz
+# This patch will not be sent upstream.  It removes the possibility of using
+# mprotect() to make memory executable, as that runs afoul of SELinux.
+Patch0:         ffcall-trampoline.patch
 
 
 %description
@@ -29,9 +32,13 @@ packages are:
 
 %prep
 %setup -q -n ffcall
+%patch0
+
+# Remove prebuilt object files
+find . -name \*.o | xargs rm -f
 
 %build
-export CFLAGS="$RPM_OPT_FLAGS -fPIC"
+export CFLAGS="$RPM_OPT_FLAGS -fPIC -DMAP_VARIABLE=2"
 %configure
 make # %{?_smp_mflags}
 
@@ -55,7 +62,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
 
 
 %changelog
-* Mon Jan  9 2012 Jerry James <loganjerry at gmail.com>
+* Tue Jan 10 2012 Jerry James <loganjerry at gmail.com> - 1.10-7.20100903cvs
+- Clean out prebuilt object files
+- Add trampoline patch to force use of mmap() to get executable memory
+
+* Mon Jan  9 2012 Jerry James <loganjerry at gmail.com> - 1.10-6.20100903cvs
 - Update to CVS 20100903
 - Minor spec file cleanups
 


More information about the scm-commits mailing list