summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2012-04-20 12:43:58 +0200
committerHans de Graaff <hans@degraaff.org>2012-04-20 12:43:58 +0200
commit66c99889dcca8a6aa17749062568a78a6319be45 (patch)
treef1b592c9c6157ad3630507b66e33d1a3a37a0897 /patchsets
parentUpdate patchset for 2012.02 release. (diff)
downloadruby-scripts-66c99889dcca8a6aa17749062568a78a6319be45.tar.gz
ruby-scripts-66c99889dcca8a6aa17749062568a78a6319be45.tar.bz2
ruby-scripts-66c99889dcca8a6aa17749062568a78a6319be45.zip
New patchset for ruby 1.8.7 p358.
Note that patch 014 is actually upstream p359, but that version is not yet released as a tarball.
Diffstat (limited to 'patchsets')
-rw-r--r--patchsets/patches-1.8.7_p358/001_memory_leak.patch59
-rw-r--r--patchsets/patches-1.8.7_p358/003_mkmf-parallel-install.patch16
-rw-r--r--patchsets/patches-1.8.7_p358/004_berkdb-5.0.patch13
-rw-r--r--patchsets/patches-1.8.7_p358/007_no-undefined-ext.patch13
-rw-r--r--patchsets/patches-1.8.7_p358/008_ppc64.patch42
-rw-r--r--patchsets/patches-1.8.7_p358/013_CVE-2011-0188.patch14
-rw-r--r--patchsets/patches-1.8.7_p358/014_marshall-bug.patch369
-rw-r--r--patchsets/patches-1.8.7_p358/series7
8 files changed, 533 insertions, 0 deletions
diff --git a/patchsets/patches-1.8.7_p358/001_memory_leak.patch b/patchsets/patches-1.8.7_p358/001_memory_leak.patch
new file mode 100644
index 0000000..98edae0
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/001_memory_leak.patch
@@ -0,0 +1,59 @@
+Index: ruby-1.8.7-p299/ext/dl/handle.c
+===================================================================
+--- ruby-1.8.7-p299.orig/ext/dl/handle.c
++++ ruby-1.8.7-p299/ext/dl/handle.c
+@@ -10,9 +10,12 @@ VALUE rb_cDLHandle;
+ void
+ dlhandle_free(struct dl_handle *dlhandle)
+ {
++ if (!dlhandle)
++ return;
+ if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) {
+ dlclose(dlhandle->ptr);
+ }
++ dlfree(dlhandle);
+ }
+
+ VALUE
+Index: ruby-1.8.7-p299/ext/dl/ptr.c
+===================================================================
+--- ruby-1.8.7-p299.orig/ext/dl/ptr.c
++++ ruby-1.8.7-p299/ext/dl/ptr.c
+@@ -45,6 +45,8 @@ rb_dlmem_aref(void *ptr)
+ void
+ dlptr_free(struct ptr_data *data)
+ {
++ if (!data)
++ return;
+ if (data->ptr) {
+ DEBUG_CODE({
+ printf("dlptr_free(): removing the pointer `0x%x' from the MemorySpace\n",
+@@ -61,6 +63,7 @@ dlptr_free(struct ptr_data *data)
+ if (data->stype) dlfree(data->stype);
+ if (data->ssize) dlfree(data->ssize);
+ if (data->ids) dlfree(data->ids);
++ dlfree(data);
+ }
+
+ void
+Index: ruby-1.8.7-p299/ext/dl/sym.c
+===================================================================
+--- ruby-1.8.7-p299.orig/ext/dl/sym.c
++++ ruby-1.8.7-p299/ext/dl/sym.c
+@@ -57,6 +57,8 @@ char2type(int ch)
+ void
+ dlsym_free(struct sym_data *data)
+ {
++ if(!data)
++ return;
+ if( data->name ){
+ DEBUG_CODE({
+ printf("dlsym_free(): free(data->name:%s)\n",data->name);
+@@ -69,6 +71,7 @@ dlsym_free(struct sym_data *data)
+ });
+ free(data->type);
+ }
++ dlfree(data);
+ }
+
+ VALUE
diff --git a/patchsets/patches-1.8.7_p358/003_mkmf-parallel-install.patch b/patchsets/patches-1.8.7_p358/003_mkmf-parallel-install.patch
new file mode 100644
index 0000000..9ecdc9b
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/003_mkmf-parallel-install.patch
@@ -0,0 +1,16 @@
+ Patch for bug 239101 by Matsuu Takuto, via Redmine issue 1337 (yes, really).
+ Backported for 1.8.* by Alex Legler.
+
+Index: ruby-1.8.7-p299/lib/mkmf.rb
+===================================================================
+--- ruby-1.8.7-p299.orig/lib/mkmf.rb
++++ ruby-1.8.7-p299/lib/mkmf.rb
+@@ -1523,7 +1523,7 @@ static: $(STATIC_LIB)#{$extout ? " inst
+ dest = "#{dir}/#{f}"
+ mfile.puts dir, "install-so: #{dest}"
+ unless $extout
+- mfile.print "#{dest}: #{f}\n"
++ mfile.print "#{dest}: #{dir} #{f}\n"
+ if (sep = config_string('BUILD_FILE_SEPARATOR'))
+ f.gsub!("/", sep)
+ dir.gsub!("/", sep)
diff --git a/patchsets/patches-1.8.7_p358/004_berkdb-5.0.patch b/patchsets/patches-1.8.7_p358/004_berkdb-5.0.patch
new file mode 100644
index 0000000..2516cd3
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/004_berkdb-5.0.patch
@@ -0,0 +1,13 @@
+Index: ruby-1.8.7-p299/ext/dbm/extconf.rb
+===================================================================
+--- ruby-1.8.7-p299.orig/ext/dbm/extconf.rb
++++ ruby-1.8.7-p299/ext/dbm/extconf.rb
+@@ -26,7 +26,7 @@ def headers.db_check(db)
+ case db
+ when /^db2?$/
+ db_prefix = "__db_n"
+- hsearch = "-DDB_DBM_HSEARCH "
++ hsearch = "-DDB_DBM_HSEARCH -DHAVE_DBM "
+ when "gdbm"
+ have_gdbm = true
+ when "gdbm_compat"
diff --git a/patchsets/patches-1.8.7_p358/007_no-undefined-ext.patch b/patchsets/patches-1.8.7_p358/007_no-undefined-ext.patch
new file mode 100644
index 0000000..41a7ddb
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/007_no-undefined-ext.patch
@@ -0,0 +1,13 @@
+Index: ruby-1.8.7-p299/configure.in
+===================================================================
+--- ruby-1.8.7-p299.orig/configure.in
++++ ruby-1.8.7-p299/configure.in
+@@ -1223,7 +1223,7 @@ if test "$with_dln_a_out" != yes; then
+ linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi*)
+ : ${LDSHARED='${CC} -shared'}
+ if test "$rb_cv_binary_elf" = yes; then
+- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
+ fi
+ rb_cv_dlopen=yes ;;
+ interix*) : ${LDSHARED="$CC -shared"}
diff --git a/patchsets/patches-1.8.7_p358/008_ppc64.patch b/patchsets/patches-1.8.7_p358/008_ppc64.patch
new file mode 100644
index 0000000..9a52cd7
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/008_ppc64.patch
@@ -0,0 +1,42 @@
+ diff --git a/eval.c b/eval.c
+ index a54fdce..e25ee24 100644
+ --- a/eval.c
+ +++ b/eval.c
+ @@ -188,6 +188,9 @@ int function_call_may_return_twice_false_2 = 0;
+ (function_call_may_return_twice_false_2 ? \
+ setjmp(function_call_may_return_twice_jmp_buf) : \
+ 0)
+ +# elif defined(__PPC64__)
+ +# define JUST_BEFORE_SETJMP(extra_save, j) ((void)0)
+ +# define JUST_AFTER_SETJMP(extra_save, j) ((j)->status ? (void)0 : (extra_save))
+ # elif defined(__FreeBSD__) && __FreeBSD__ < 7
+ /*
+ * workaround for FreeBSD/i386 getcontext/setcontext bug.
+ @@ -205,16 +208,23 @@ static int volatile freebsd_clear_carry_flag = 0;
+ # ifndef POST_GETCONTEXT
+ # define POST_GETCONTEXT 0
+ # endif
+ +# ifndef JUST_BEFORE_SETJMP
+ +# define JUST_BEFORE_SETJMP(extra_save, j) (extra_save)
+ +# endif
+ +# ifndef JUST_AFTER_SETJMP
+ +# define JUST_AFTER_SETJMP(extra_save, j) ((void)0)
+ +# endif
+ # define ruby_longjmp(env, val) rb_jump_context(env, val)
+ -# define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \
+ - (just_before_setjmp), \
+ +# define ruby_setjmp(extra_save, j) ((j)->status = 0, \
+ + JUST_BEFORE_SETJMP(extra_save, j), \
+ PRE_GETCONTEXT, \
+ getcontext(&(j)->context), \
+ POST_GETCONTEXT, \
+ + JUST_AFTER_SETJMP(extra_save, j), \
+ (j)->status)
+ #else
+ -# define ruby_setjmp(just_before_setjmp, env) \
+ - ((just_before_setjmp), RUBY_SETJMP(env))
+ +# define ruby_setjmp(extra_save, env) \
+ + ((extra_save), RUBY_SETJMP(env))
+ # define ruby_longjmp(env,val) RUBY_LONGJMP(env,val)
+ # ifdef __CYGWIN__
+ # ifndef _setjmp
diff --git a/patchsets/patches-1.8.7_p358/013_CVE-2011-0188.patch b/patchsets/patches-1.8.7_p358/013_CVE-2011-0188.patch
new file mode 100644
index 0000000..9e29917
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/013_CVE-2011-0188.patch
@@ -0,0 +1,14 @@
+Patch backported from upstream revision 30993 by a3li@gentoo.org.
+
+diff -Naur ruby-1.8.7-p334.orig/ext/bigdecimal/bigdecimal.c ruby-1.8.7-p334/ext/bigdecimal/bigdecimal.c
+--- ruby-1.8.7-p334.orig/ext/bigdecimal/bigdecimal.c 2010-06-08 09:49:18.000000000 +0200
++++ ruby-1.8.7-p334/ext/bigdecimal/bigdecimal.c 2011-05-31 20:53:23.268999218 +0200
+@@ -2032,7 +2032,7 @@
+ VP_EXPORT void *
+ VpMemAlloc(U_LONG mb)
+ {
+- void *p = xmalloc((unsigned int)mb);
++ void *p = xmalloc(mb);
+ if(!p) {
+ VpException(VP_EXCEPTION_MEMORY,"failed to allocate memory",1);
+ }
diff --git a/patchsets/patches-1.8.7_p358/014_marshall-bug.patch b/patchsets/patches-1.8.7_p358/014_marshall-bug.patch
new file mode 100644
index 0000000..5c541f0
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/014_marshall-bug.patch
@@ -0,0 +1,369 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 34866)
++++ ChangeLog (revision 34867)
+@@ -1,3 +1,17 @@
++Fri Mar 2 11:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
++
++ * marshal.c (mark_dump_arg): mark destination string. patch by
++ Vit Ondruch. [Bug #4339]
++
++ * marshal.c (clear_dump_arg, clear_load_arg): clean up also data
++ tables as same as symbols tables.
++
++Fri Mar 2 11:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
++
++ * marshal.c (struct {dump,load}_arg): manage with dfree, instead
++ of using local variable which may be moved by context switch.
++ [ruby-dev:39425]
++
+ Wed Feb 8 14:06:59 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c: Add SSL constants and allow to unset SSL
+Index: version.h
+===================================================================
+--- version.h (revision 34866)
++++ version.h (revision 34867)
+@@ -1,15 +1,15 @@
+ #define RUBY_VERSION "1.8.7"
+-#define RUBY_RELEASE_DATE "2012-02-08"
++#define RUBY_RELEASE_DATE "2012-03-02"
+ #define RUBY_VERSION_CODE 187
+-#define RUBY_RELEASE_CODE 20120208
+-#define RUBY_PATCHLEVEL 358
++#define RUBY_RELEASE_CODE 20120302
++#define RUBY_PATCHLEVEL 359
+
+ #define RUBY_VERSION_MAJOR 1
+ #define RUBY_VERSION_MINOR 8
+ #define RUBY_VERSION_TEENY 7
+ #define RUBY_RELEASE_YEAR 2012
+-#define RUBY_RELEASE_MONTH 2
+-#define RUBY_RELEASE_DAY 8
++#define RUBY_RELEASE_MONTH 3
++#define RUBY_RELEASE_DAY 2
+
+ #ifdef RUBY_EXTERN
+ RUBY_EXTERN const char ruby_version[];
+Index: marshal.c
+===================================================================
+--- marshal.c (revision 34866)
++++ marshal.c (revision 34867)
+@@ -85,12 +85,10 @@
+ static ID s_getc, s_read, s_write, s_binmode;
+
+ struct dump_arg {
+- VALUE obj;
+ VALUE str, dest;
+ st_table *symbols;
+ st_table *data;
+ int taint;
+- VALUE wrapper;
+ };
+
+ struct dump_call_arg {
+@@ -104,22 +102,33 @@
+ struct dump_arg *arg;
+ ID sym;
+ {
+- if (!DATA_PTR(arg->wrapper)) {
++ if (!arg->symbols) {
+ rb_raise(rb_eRuntimeError, "Marshal.dump reentered at %s",
+ rb_id2name(sym));
+ }
+ }
+
++static void clear_dump_arg _((struct dump_arg *arg));
++
+ static void
+ mark_dump_arg(ptr)
+ void *ptr;
+ {
+ struct dump_arg *p = ptr;
+- if (!ptr)
++ if (!p->symbols)
+ return;
+ rb_mark_set(p->data);
++ rb_gc_mark(p->str);
+ }
+
++static void
++free_dump_arg(ptr)
++ void *ptr;
++{
++ clear_dump_arg(ptr);
++ xfree(ptr);
++}
++
+ static VALUE
+ class2path(klass)
+ VALUE klass;
+@@ -699,32 +708,18 @@
+ }
+ }
+
+-static VALUE
+-dump(arg)
+- struct dump_call_arg *arg;
+-{
+- w_object(arg->obj, arg->arg, arg->limit);
+- if (arg->arg->dest) {
+- rb_io_write(arg->arg->dest, arg->arg->str);
+- rb_str_resize(arg->arg->str, 0);
+- }
+- return 0;
+-}
+-
+-static VALUE
+-dump_ensure(arg)
++static void
++clear_dump_arg(arg)
+ struct dump_arg *arg;
+ {
+- if (!DATA_PTR(arg->wrapper)) return 0;
++ if (!arg->symbols) return;
+ st_free_table(arg->symbols);
++ arg->symbols = 0;
+ st_free_table(arg->data);
+- DATA_PTR(arg->wrapper) = 0;
+- arg->wrapper = 0;
++ arg->data = 0;
+ if (arg->taint) {
+ OBJ_TAINT(arg->str);
+ }
+-
+- return 0;
+ }
+
+ /*
+@@ -760,8 +755,8 @@
+ {
+ VALUE obj, port, a1, a2;
+ int limit = -1;
+- struct dump_arg arg;
+- struct dump_call_arg c_arg;
++ struct dump_arg *arg;
++ VALUE wrapper;
+
+ port = Qnil;
+ rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
+@@ -775,37 +770,40 @@
+ else if (NIL_P(a1)) goto type_error;
+ else port = a1;
+ }
+- arg.dest = 0;
+- arg.symbols = st_init_numtable();
+- arg.data = st_init_numtable();
+- arg.taint = Qfalse;
+- arg.str = rb_str_buf_new(0);
+- RBASIC(arg.str)->klass = 0;
+- arg.wrapper = Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, &arg);
++ wrapper = Data_Make_Struct(rb_cData, struct dump_arg, mark_dump_arg, free_dump_arg, arg);
++ arg->dest = 0;
++ arg->symbols = st_init_numtable();
++ arg->data = st_init_numtable();
++ arg->taint = Qfalse;
++ arg->str = rb_str_buf_new(0);
++ RBASIC(arg->str)->klass = 0;
+ if (!NIL_P(port)) {
+ if (!rb_respond_to(port, s_write)) {
+ type_error:
+ rb_raise(rb_eTypeError, "instance of IO needed");
+ }
+- arg.dest = port;
++ arg->dest = port;
+ if (rb_respond_to(port, s_binmode)) {
+ rb_funcall2(port, s_binmode, 0, 0);
+- check_dump_arg(&arg, s_binmode);
++ check_dump_arg(arg, s_binmode);
+ }
+ }
+ else {
+- port = arg.str;
++ port = arg->str;
+ }
+
+- c_arg.obj = obj;
+- c_arg.arg = &arg;
+- c_arg.limit = limit;
++ w_byte(MARSHAL_MAJOR, arg);
++ w_byte(MARSHAL_MINOR, arg);
+
+- w_byte(MARSHAL_MAJOR, &arg);
+- w_byte(MARSHAL_MINOR, &arg);
++ w_object(obj, arg, limit);
++ if (arg->dest) {
++ rb_io_write(arg->dest, arg->str);
++ rb_str_resize(arg->str, 0);
++ }
+
+- rb_ensure(dump, (VALUE)&c_arg, dump_ensure, (VALUE)&arg);
+- RBASIC(arg.str)->klass = rb_cString;
++ RBASIC(arg->str)->klass = rb_cString;
++ clear_dump_arg(arg);
++ RB_GC_GUARD(wrapper);
+
+ return port;
+ }
+@@ -817,7 +815,6 @@
+ st_table *data;
+ VALUE proc;
+ int taint;
+- VALUE wrapper;
+ };
+
+ static void
+@@ -825,22 +822,31 @@
+ struct load_arg *arg;
+ ID sym;
+ {
+- if (!DATA_PTR(arg->wrapper)) {
++ if (!arg->symbols) {
+ rb_raise(rb_eRuntimeError, "Marshal.load reentered at %s",
+ rb_id2name(sym));
+ }
+ }
+
++static void clear_load_arg _((struct load_arg *arg));
++
+ static void
+ mark_load_arg(ptr)
+ void *ptr;
+ {
+ struct load_arg *p = ptr;
+- if (!ptr)
++ if (!p->symbols)
+ return;
+ rb_mark_tbl(p->data);
+ }
+
++static void
++free_load_arg(void *ptr)
++{
++ clear_load_arg(ptr);
++ xfree(ptr);
++}
++
+ static VALUE r_object _((struct load_arg *arg));
+
+ static int
+@@ -1415,23 +1421,15 @@
+ return r_object0(arg, arg->proc, 0, Qnil);
+ }
+
+-static VALUE
+-load(arg)
++static void
++clear_load_arg(arg)
+ struct load_arg *arg;
+ {
+- return r_object(arg);
+-}
+-
+-static VALUE
+-load_ensure(arg)
+- struct load_arg *arg;
+-{
+- if (!DATA_PTR(arg->wrapper)) return 0;
++ if (!arg->symbols) return;
+ st_free_table(arg->symbols);
++ arg->symbols = 0;
+ st_free_table(arg->data);
+- DATA_PTR(arg->wrapper) = 0;
+- arg->wrapper = 0;
+- return 0;
++ arg->data = 0;
+ }
+
+ /*
+@@ -1452,8 +1450,8 @@
+ {
+ VALUE port, proc;
+ int major, minor, taint = Qfalse;
+- VALUE v;
+- struct load_arg arg;
++ VALUE v, wrapper;
++ struct load_arg *arg;
+
+ rb_scan_args(argc, argv, "11", &port, &proc);
+ v = rb_check_string_type(port);
+@@ -1470,17 +1468,18 @@
+ else {
+ rb_raise(rb_eTypeError, "instance of IO needed");
+ }
+- arg.src = port;
+- arg.offset = 0;
+- arg.symbols = st_init_numtable();
+- arg.data = st_init_numtable();
+- arg.proc = 0;
+- arg.wrapper = Data_Wrap_Struct(rb_cData, mark_load_arg, 0, &arg);
+- arg.taint = taint;
++ wrapper = Data_Make_Struct(rb_cData, struct load_arg, mark_load_arg, free_load_arg, arg);
++ arg->src = port;
++ arg->offset = 0;
++ arg->symbols = st_init_numtable();
++ arg->data = st_init_numtable();
++ arg->proc = 0;
++ arg->taint = taint;
+
+- major = r_byte(&arg);
+- minor = r_byte(&arg);
++ major = r_byte(arg);
++ minor = r_byte(arg);
+ if (major != MARSHAL_MAJOR || minor > MARSHAL_MINOR) {
++ clear_load_arg(arg);
+ rb_raise(rb_eTypeError, "incompatible marshal file format (can't be read)\n\
+ \tformat version %d.%d required; %d.%d given",
+ MARSHAL_MAJOR, MARSHAL_MINOR, major, minor);
+@@ -1491,8 +1490,10 @@
+ MARSHAL_MAJOR, MARSHAL_MINOR, major, minor);
+ }
+
+- if (!NIL_P(proc)) arg.proc = proc;
+- v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
++ if (!NIL_P(proc)) arg->proc = proc;
++ v = r_object(arg);
++ clear_load_arg(arg);
++ RB_GC_GUARD(wrapper);
+
+ return v;
+ }
+Index: test/ruby/test_marshal.rb
+===================================================================
+--- test/ruby/test_marshal.rb (revision 34866)
++++ test/ruby/test_marshal.rb (revision 34867)
+@@ -72,6 +72,34 @@
+ assert_equal("marshal data too short", e.message)
+ end
+
++ class DumpTest
++ def marshal_dump
++ loop { Thread.pass }
++ end
++ end
++
++ class LoadTest
++ def marshal_dump
++ nil
++ end
++ def marshal_load(obj)
++ loop { Thread.pass }
++ end
++ end
++
++ def test_context_switch
++ o = DumpTest.new
++ Thread.new { Marshal.dump(o) }
++ GC.start
++ assert(true, '[ruby-dev:39425]')
++
++ o = LoadTest.new
++ m = Marshal.dump(o)
++ Thread.new { Marshal.load(m) }
++ GC.start
++ assert(true, '[ruby-dev:39425]')
++ end
++
+ def test_taint
+ x = Object.new
+ x.taint
diff --git a/patchsets/patches-1.8.7_p358/series b/patchsets/patches-1.8.7_p358/series
new file mode 100644
index 0000000..fb2c173
--- /dev/null
+++ b/patchsets/patches-1.8.7_p358/series
@@ -0,0 +1,7 @@
+001_memory_leak.patch
+003_mkmf-parallel-install.patch
+004_berkdb-5.0.patch
+007_no-undefined-ext.patch
+008_ppc64.patch
+013_CVE-2011-0188.patch
+014_marshall-bug.patch