------- Start of forwarded message ------- Subject: GCL patch for Fedora Core 5 From: =?ISO-8859-1?Q?G=E9rard?= Milmeister <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] In-Reply-To: <[EMAIL PROTECTED]> Content-Type: multipart/mixed; boundary="=-0BwGir19qmPpuYENcGhB" Organization: =?ISO-8859-1?Q?Universit=E4t?= =?ISO-8859-1?Q?_Z=FCrich?= Date: Tue, 28 Mar 2006 16:47:01 +0200
- --=-0BwGir19qmPpuYENcGhB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here are the patches I use for compiling GCL on FC5: gcl-bash.patch: configure contains a bug concering quotes and parentheses that has only been triggered by newer bash gcl-pers.patch: this concerns the personality switch because of randomized linking etc ... There has been some code in GCL, but this doesn't work anymore. - -- Gérard Milmeister Langackerstrasse 49 CH-8057 Zürich - --=-0BwGir19qmPpuYENcGhB Content-Disposition: attachment; filename=gcl-bash.patch Content-Type: text/x-patch; name=gcl-bash.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit - --- gcl-2.6.7/configure.bash 2006-03-08 20:50:04.000000000 +0100 +++ gcl-2.6.7/configure 2006-03-08 20:52:25.000000000 +0100 @@ -1711,7 +1711,7 @@ # results, and the version is kept in special file). if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then - - system=MP-RAS-`${AWK} '{print $3}' /etc/.relid'` + system=MP-RAS-`${AWK} '{print $3}' '/etc/.relid'` fi if test "`uname -s`" = "AIX" ; then system=AIX-`uname -v`.`uname -r` @@ -2409,7 +2409,7 @@ X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - - case "`(uname -sr) 2>/dev/null`" in + case "`uname -sr 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 echo "configure:2416: checking whether -R must be followed by a space" >&5 - --=-0BwGir19qmPpuYENcGhB Content-Disposition: attachment; filename=gcl-pers.patch Content-Type: text/x-patch; name=gcl-pers.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit - --- gcl-2.6.7/o/main.c.pers 2005-09-09 20:36:46.000000000 +0200 +++ gcl-2.6.7/o/main.c 2005-09-09 21:07:51.000000000 +0200 @@ -117,11 +117,9 @@ #endif #endif - -#ifdef NEED_NONRANDOM_SBRK #include <syscall.h> - -#include <linux/personality.h> +#include <sys/personality.h> #include <unistd.h> - -#endif int main(int argc, char **argv, char **envp) { @@ -131,14 +129,25 @@ #endif #endif - -#ifdef NEED_NONRANDOM_SBRK - -#if SIZEOF_LONG == 4 - - if (!syscall(SYS_personality,PER_LINUX32)) - -#else - - if (!syscall(SYS_personality,PER_LINUX)) - -#endif - - execvp(argv[0],argv); - -#endif + 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. + */ + } #if defined(DARWIN) extern void init_darwin_zone_compat (); - --- gcl-2.6.7/configure.pers 2005-09-09 20:51:26.000000000 +0200 +++ gcl-2.6.7/configure 2005-09-09 21:06:56.000000000 +0200 @@ -3887,17 +3887,18 @@ #line 3888 "configure" #include "confdefs.h" #include <syscall.h> - - #include <linux/personality.h> + #include <sys/personality.h> #include <stdio.h> #include <unistd.h> int main(int argc,char * argv[]) { FILE *f; - - #if SIZEOF_LONG == 4 - - if (!syscall(SYS_personality,PER_LINUX32)) - - #else - - if (!syscall(SYS_personality,PER_LINUX)) - - #endif - - execvp(argv[0],argv); + long pers = personality(-1); + if (!(pers & 0x40000)) { + if (personality(pers | 0x40000) != -1) { + execvp(argv[0],argv); + } + } + if (!(f=fopen("conftest1","w"))) return -1; fprintf(f,"%u",sbrk(0)); @@ -3927,17 +3928,17 @@ #line 3928 "configure" #include "confdefs.h" #include <syscall.h> - - #include <linux/personality.h> + #include <sys/personality.h> #include <stdio.h> #include <unistd.h> int main(int argc,char * argv[]) { FILE *f; - - #if SIZEOF_LONG == 4 - - if (!syscall(SYS_personality,PER_LINUX32)) - - #else - - if (!syscall(SYS_personality,PER_LINUX)) - - #endif - - execvp(argv[0],argv); + long pers = personality(-1); + if (!(pers & 0x40000)) { + if (personality(pers | 0x40000) != -1) { + execvp(argv[0],argv); + } + } if (!(f=fopen("conftest1","w"))) return -1; fprintf(f,"%u",sbrk(0)); @@ -3989,25 +3990,22 @@ #include "confdefs.h" #include <stdio.h> #include <stdlib.h> - - #ifdef NEED_NONRANDOM_SBRK #include <syscall.h> - - #include <linux/personality.h> + #include <sys/personality.h> #include <unistd.h> - - #endif int main(int argc,char * argv[]) { char *b; FILE *fp; - -#ifdef NEED_NONRANDOM_SBRK - -#if SIZEOF_LONG == 4 - -if (!syscall(SYS_personality,PER_LINUX32)) - -#else - -if (!syscall(SYS_personality,PER_LINUX)) - -#endif - - execvp(argv[0],argv); - -#endif + long pers = personality(-1); + if (!(pers & 0x40000)) { + if (personality(pers | 0x40000) != -1) { + execvp(argv[0],argv); + } + } + b = (void *) malloc(1000); fp = fopen("conftest1","w"); - --=-0BwGir19qmPpuYENcGhB-- ------- End of forwarded message ------- _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer