rpms/sbcl/devel sbcl-0.9.4-ADDR_NO_RANDOMIZE-argv0.patch, NONE, 1.1 sbcl-0.9.4-ADDR_NO_RANDOMIZE-proc.patch, NONE, 1.1 sbcl.sysconfig, NONE, 1.1 sbcl-0.9.4-LIB_DIR.patch, 1.1, 1.2 sbcl.sh, 1.2, 1.3 sbcl.spec, 1.7, 1.8 sbcl-0.9.4-ADDR_NO_RANDOMIZE.patch, 1.1, NONE
Rex Dieter (rdieter)
fedora-extras-commits at redhat.com
Tue Sep 13 16:50:46 UTC 2005
Author: rdieter
Update of /cvs/extras/rpms/sbcl/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10989
Modified Files:
sbcl-0.9.4-LIB_DIR.patch sbcl.sh sbcl.spec
Added Files:
sbcl-0.9.4-ADDR_NO_RANDOMIZE-argv0.patch
sbcl-0.9.4-ADDR_NO_RANDOMIZE-proc.patch sbcl.sysconfig
Removed Files:
sbcl-0.9.4-ADDR_NO_RANDOMIZE.patch
Log Message:
* Tue Sep 13 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-11
- fix botched NO_ADDR_RANDOMIZE patch
- fix botched LIB_DIR patch
sbcl-0.9.4-ADDR_NO_RANDOMIZE-argv0.patch:
--- NEW FILE sbcl-0.9.4-ADDR_NO_RANDOMIZE-argv0.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[], char *envp[]);
/* 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[], char *envp[])
{
/* 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) {
+ execve(argv[0], argv, envp);
+ }
+ /* Either changing the personality or execve() 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/osf1-os.c.ADDR_NO_RANDOMIZE 2005-07-14 10:41:20.000000000 -0500
+++ sbcl-0.9.4/src/runtime/osf1-os.c 2005-09-13 11:23:31.321884302 -0500
@@ -51,7 +51,8 @@
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
os_vm_page_size = getpagesize();
}
--- sbcl-0.9.4/src/runtime/bsd-os.c.ADDR_NO_RANDOMIZE 2005-07-14 10:41:11.000000000 -0500
+++ sbcl-0.9.4/src/runtime/bsd-os.c 2005-09-13 11:23:31.322884261 -0500
@@ -51,7 +51,8 @@
static void netbsd_init();
#endif /* __NetBSD__ */
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
os_vm_page_size = getpagesize();
--- 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, envp);
arch_init();
gc_init();
validate();
--- sbcl-0.9.4/src/runtime/sunos-os.c.ADDR_NO_RANDOMIZE 2005-08-19 07:15:16.000000000 -0500
+++ sbcl-0.9.4/src/runtime/sunos-os.c 2005-09-13 11:23:31.324884178 -0500
@@ -53,7 +53,8 @@
int KLUDGE_MAYBE_MAP_ANON = 0x0;
int kludge_mmap_fd = -1; /* default for MAP_ANON */
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
struct utsname name;
int major_version;
sbcl-0.9.4-ADDR_NO_RANDOMIZE-proc.patch:
--- NEW FILE sbcl-0.9.4-ADDR_NO_RANDOMIZE-proc.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-08-30 12:16:42.781282788 -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[], char *envp[]);
/* 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-08-30 12:17:31.208291595 -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[], char *envp[])
{
/* 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,36 @@
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) {
+ /* Use /proc/self/exe instead of trying to figure out the
+ * executable path from PATH and argv[0], since that's reliable.
+ */
+ char buf[PATH_MAX+1];
+ int rc = readlink("/proc/self/exe", buf, PATH_MAX);
+ if ( rc > 0 ) {
+ buf[rc]=0;
+ execve(buf, argv, envp);
+ }
+ }
+ /* Either changing the personality or execve() 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 (maybe /proc isn't mounted?). Trying to continue anyway.\n");
+ }
+ }
+#endif
}
--- sbcl-0.9.4/src/runtime/osf1-os.c.ADDR_NO_RANDOMIZE 2005-07-14 10:41:20.000000000 -0500
+++ sbcl-0.9.4/src/runtime/osf1-os.c 2005-08-30 12:16:42.783282706 -0500
@@ -51,7 +51,8 @@
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
os_vm_page_size = getpagesize();
}
--- sbcl-0.9.4/src/runtime/bsd-os.c.ADDR_NO_RANDOMIZE 2005-07-14 10:41:11.000000000 -0500
+++ sbcl-0.9.4/src/runtime/bsd-os.c 2005-08-30 12:16:42.784282665 -0500
@@ -51,7 +51,8 @@
static void netbsd_init();
#endif /* __NetBSD__ */
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
os_vm_page_size = getpagesize();
--- sbcl-0.9.4/src/runtime/runtime.c.ADDR_NO_RANDOMIZE 2005-08-30 12:16:42.778282911 -0500
+++ sbcl-0.9.4/src/runtime/runtime.c 2005-08-30 12:16:42.785282623 -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, envp);
arch_init();
gc_init();
validate();
--- sbcl-0.9.4/src/runtime/sunos-os.c.ADDR_NO_RANDOMIZE 2005-08-19 07:15:16.000000000 -0500
+++ sbcl-0.9.4/src/runtime/sunos-os.c 2005-08-30 12:16:42.786282582 -0500
@@ -53,7 +53,8 @@
int KLUDGE_MAYBE_MAP_ANON = 0x0;
int kludge_mmap_fd = -1; /* default for MAP_ANON */
-void os_init(void)
+void
+os_init(char *argv[], char *envp[])
{
struct utsname name;
int major_version;
--- NEW FILE sbcl.sysconfig ---
# /etc/sysconfig/sbcl
SBCL_HOME=/usr/lib/sbcl
sbcl-0.9.4-LIB_DIR.patch:
Index: sbcl-0.9.4-LIB_DIR.patch
===================================================================
RCS file: /cvs/extras/rpms/sbcl/devel/sbcl-0.9.4-LIB_DIR.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sbcl-0.9.4-LIB_DIR.patch 12 Sep 2005 19:18:17 -0000 1.1
+++ sbcl-0.9.4-LIB_DIR.patch 13 Sep 2005 16:50:44 -0000 1.2
@@ -4,7 +4,7 @@
MAN_DIR=${MAN_DIR-$INSTALL_ROOT/share/man}
INFO_DIR=${INFO_DIR-$INSTALL_ROOT/share/info}
DOC_DIR=${DOC_DIR-$INSTALL_ROOT/share/doc/sbcl}
-+LIB_DIR=${LIB_DIR-$INSTALL_ROOT/lib}}
++LIB_DIR=${LIB_DIR-$INSTALL_ROOT/lib}
# Does the environment look sane?
SBCL_SOURCE=`pwd`
Index: sbcl.sh
===================================================================
RCS file: /cvs/extras/rpms/sbcl/devel/sbcl.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sbcl.sh 12 Sep 2005 12:39:38 -0000 1.2
+++ sbcl.sh 13 Sep 2005 16:50:44 -0000 1.3
@@ -5,13 +5,4 @@
source /etc/sysconfig/sbcl
fi
-if [ -z "$SBCL_HOME" ] ; then
-SBCL_HOME=/usr/lib/sbcl
-export SBCL_HOME
-fi
-
-if [ -z "$SBCL_SETARCH" ] ; then
-SBCL_SETARCH="setarch i386 -R"
-fi
-
-exec ${SBCL_SETARCH} ${SBCL_HOME}/sbcl ${1+"$@"}
+exec ${SBCL_HOME}/sbcl ${1+"$@"}
Index: sbcl.spec
===================================================================
RCS file: /cvs/extras/rpms/sbcl/devel/sbcl.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- sbcl.spec 12 Sep 2005 20:36:18 -0000 1.7
+++ sbcl.spec 13 Sep 2005 16:50:44 -0000 1.8
@@ -13,24 +13,31 @@
%define setarch setarch %{_target_cpu}
%endif
-# Could test for setarch >= 1.7 instead
%if "%{?fedora}" >= "4"
%define setarch setarch %{_target_cpu} -R
%endif
+%if "%{?rhel}" >= "4"
+BuildRequires:setarch
+Requires:setarch
+%define setarch setarch %{_target_cpu}
+%endif
+
Name: sbcl
Summary: Steel Bank Common Lisp
Version: 0.9.4
-Release: 10%{?dist}
+Release: 11%{?dist}
License: BSD/MIT
Group: Development/Languages
URL: http://sbcl.sourceforge.net/
Source0: http://dl.sourceforge.net/sourceforge/sbcl/sbcl-%{version}-source.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-ExclusiveArch: %{ix86}
+# App-wrapper
Source1: sbcl.sh
+# /etc/sysconfig/sbcl
+Source2: sbcl.sysconfig
%if "%{?sbcl_bootstrap}" == "%{nil}"
# local Bootstrap binaries
@@ -51,7 +58,10 @@
Patch1: sbcl-0.8.18-default-sbcl-home.patch
# See http://sourceforge.net/mailarchive/message.php?msg_id=12787069
-Patch2: sbcl-0.9.4-ADDR_NO_RANDOMIZE.patch
+# use /proc/self/exe
+#Patch2: sbcl-0.9.4-ADDR_NO_RANDOMIZE-proc.patch
+# use argv[0]
+Patch2: sbcl-0.9.4-ADDR_NO_RANDOMIZE-argv0.patch
Patch3: sbcl-0.9.4-optflags.patch
Patch4: sbcl-0.9.4-LIB_DIR.patch
@@ -70,12 +80,12 @@
%prep
-%setup %{?sbcl_bootstrap_src}
+%setup -q %{?sbcl_bootstrap_src}
#sed -i -e "s|/usr/local/lib/sbcl/|%{_libdir}/sbcl/|" src/runtime/runtime.c
#or patch to use SBCL_HOME env var
%patch1 -p0 -b .default-sbcl-home
-%patch2 -p1 -b .ADDR_NO_RANDOMIZE
+%{?setarch:%patch2 -p1 -b .ADDR_NO_RANDOMIZE}
%patch3 -p1 -b .optflags
%patch4 -p1 -b .LIB_DIR
@@ -120,11 +130,11 @@
%check || :
-#if "%{?_with_check:1}" == "1"
pushd tests
-%{?setarch} sh ./run-tests.sh
+# still need setarch if using ADDR_NO_RANDOMIZE-proc patch, since /proc isn't available on buildsystem/mock.
+#{?setarch} sh ./run-tests.sh
+sh ./run-tests.sh
popd
-#endif
%install
@@ -134,15 +144,15 @@
unset SBCL_HOME ||:
export INSTALL_ROOT=$RPM_BUILD_ROOT%{_prefix}
export LIB_DIR=$RPM_BUILD_ROOT%{_libdir}
-%{?setarch} sh ./install.sh
+# (may) still need setarch if using ADDR_NO_RANDOMIZE-proc patch
+sh ./install.sh
-# app-wrapper for using setarch
+# app-wrapper
%if 0
-%if "%{?setarch}" != "%{nil}"
mv $RPM_BUILD_ROOT%{_bindir}/sbcl $RPM_BUILD_ROOT%{_libdir}/sbcl/sbcl
-install -p -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/sbcl
-sed -i -e "s|^SBCL_SETARCH=.*|SBCL_SETARCH=\"%{setarch}\"|" $RPM_BUILD_ROOT%{_bindir}/sbcl
-%endif
+install -p -m755 -D %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/sbcl
+install -p -m644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sbcl
+#{?setarch:echo "SBCL_SETARCH=\"%{setarch}\"|" >> $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sbcl
%endif
## Unpackaged files
@@ -181,7 +191,11 @@
%changelog
-* Mon Sep 13 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-10
+* Tue Sep 13 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-11
+- fix botched NO_ADDR_RANDOMIZE patch
+- fix botched LIB_DIR patch
+
+* Mon Sep 12 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.9.4-10
- use/define LIB_DIR instead of hard-coded INSTALL_ROOT/lib
- ExclusiveArch: %{ix86} (for now)
--- sbcl-0.9.4-ADDR_NO_RANDOMIZE.patch DELETED ---
More information about the fedora-extras-commits
mailing list