rpms/sbcl/FC-4 sbcl-0.9.4-personality.patch, NONE, 1.1 sbcl.spec, 1.12, 1.13

Rex Dieter (rdieter) fedora-extras-commits at redhat.com
Mon Sep 19 20:47:51 UTC 2005


Author: rdieter

Update of /cvs/extras/rpms/sbcl/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv389

Modified Files:
	sbcl.spec 
Added Files:
	sbcl-0.9.4-personality.patch 
Log Message:
forgot new patch


sbcl-0.9.4-personality.patch:

--- NEW FILE sbcl-0.9.4-personality.patch ---
--- sbcl-0.9.4/src/runtime/os.h.ADDR_NO_RANDOMIZE	2005-07-14 10:41:20.000000000 -0500
+++ sbcl-0.9.4/src/runtime/os.h	2005-09-13 11:23:31.319884384 -0500
@@ -50,7 +50,7 @@
 
 /* Do anything we need to do when starting up the runtime environment
  * in this OS. */
-extern void os_init(void);
+extern void os_init(char *argv[]);
 
 /* Install any OS-dependent low-level signal handlers which are needed
  * by the runtime environment. E.g. the signals raised by a violation
--- sbcl-0.9.4/src/runtime/linux-os.c.ADDR_NO_RANDOMIZE	2005-08-12 14:08:19.000000000 -0500
+++ sbcl-0.9.4/src/runtime/linux-os.c	2005-09-13 11:26:47.110833967 -0500
@@ -44,6 +44,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <linux/version.h>
+#include <sys/personality.h>
 
 #include "validate.h"
 #include "thread.h"
@@ -92,7 +93,7 @@
 int linux_no_threads_p = 0;
 
 void
-os_init(void)
+os_init(char *argv[])
 {
     /* Conduct various version checks: do we have enough mmap(), is
      * this a sparc running 2.2, can we do threads? */
@@ -117,7 +118,7 @@
         FSHOW((stderr,"linux kernel %d.%d predates 2.4;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", major_version,minor_version));
         linux_sparc_siginfo_bug = 1;
 #endif
-    }
+    }   
 #ifdef LISP_FEATURE_SB_THREAD
     futex_wait(futex,-1);
     if(errno==ENOSYS)  linux_no_threads_p = 1;
@@ -125,6 +126,28 @@
         fprintf(stderr,"Linux with NPTL support (e.g. kernel 2.6 or newer) required for \nthread-enabled SBCL.  Disabling thread support.\n\n");
 #endif
     os_vm_page_size = getpagesize();
+   
+    /* KLUDGE: Disable memory randomization on new Linux kernels
+     * by setting a personality flag and re-executing. (We need
+     * to re-execute, since the memory maps that can conflict with
+     * the SBCL spaces have already been done at this point).
+     */
+#if defined(LISP_FEATURE_X86)
+    if ((major_version == 2) && (minor_version >= 6) || (major_version >= 3)) {
+       long pers = personality(-1);
+       /* 0x40000 aka. ADDR_NO_RANDOMIZE */
+       if (!(pers & 0x40000)) {
+	 if (personality(pers | 0x40000) != -1) {
+	   execvp(argv[0], argv);
+	 }
+	 /* Either changing the personality or (re)exec failed. Either
+	  * way we might as well continue, and hope that the random
+	  * memory maps are ok this time around.
+	  */
+	 fprintf(stderr, "WARNING: Couldn't re-execute SBCL with the proper personality flags.  Trying to continue anyway.\n");
+       }
+    }     
+#endif   
 }
 
 
--- sbcl-0.9.4/src/runtime/runtime.c.ADDR_NO_RANDOMIZE	2005-09-13 11:23:31.315884548 -0500
+++ sbcl-0.9.4/src/runtime/runtime.c	2005-09-13 11:23:31.323884220 -0500
@@ -194,7 +194,7 @@
     /* KLUDGE: os_vm_page_size is set by os_init(), and on some
      * systems (e.g. Alpha) arch_init() needs need os_vm_page_size, so
      * it must follow os_init(). -- WHN 2000-01-26 */
-    os_init();
+    os_init(argv);
     arch_init();
     gc_init();
     validate();


Index: sbcl.spec
===================================================================
RCS file: /cvs/extras/rpms/sbcl/FC-4/sbcl.spec,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sbcl.spec	19 Sep 2005 20:46:58 -0000	1.12
+++ sbcl.spec	19 Sep 2005 20:47:49 -0000	1.13
@@ -24,7 +24,7 @@
 Name: 	 sbcl
 Summary: Steel Bank Common Lisp
 Version: 0.9.4
-Release: 16%{?dist}
+Release: 17%{?dist}
 
 License: BSD/MIT
 Group: 	 Development/Languages
@@ -170,7 +170,7 @@
 
 
 %changelog
-* Mon Sep 19 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-16
+* Mon Sep 19 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-17
 - rework personality/reexec patch (execve -> execvp)
 
 * Sat Sep 16 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-15




More information about the fedora-extras-commits mailing list