aboutsummaryrefslogtreecommitdiff
path: root/lang/ruby18/files
diff options
context:
space:
mode:
authorSergey Matveychuk <sem@FreeBSD.org>2006-08-27 09:53:28 +0000
committerSergey Matveychuk <sem@FreeBSD.org>2006-08-27 09:53:28 +0000
commit1e52ae8d80b335ae91539fac999e9f0c986e0588 (patch)
treebae13129865c329d43bdd68dc8f4ff7a93a64ee3 /lang/ruby18/files
parente84761b4064ccfb914650614136062defed4eb03 (diff)
Notes
Diffstat (limited to 'lang/ruby18/files')
-rw-r--r--lang/ruby18/files/patch-dir.c-security30
-rw-r--r--lang/ruby18/files/patch-eval.c129
-rw-r--r--lang/ruby18/files/patch-eval.c-security35
-rw-r--r--lang/ruby18/files/patch-ext-dbm-extconf.rb11
-rw-r--r--lang/ruby18/files/patch-fileutils.rb10
-rw-r--r--lang/ruby18/files/patch-re.c-security11
6 files changed, 11 insertions, 215 deletions
diff --git a/lang/ruby18/files/patch-dir.c-security b/lang/ruby18/files/patch-dir.c-security
deleted file mode 100644
index 5b57a13db4cc..000000000000
--- a/lang/ruby18/files/patch-dir.c-security
+++ /dev/null
@@ -1,30 +0,0 @@
---- dir.c.orig Thu Jul 13 01:48:12 2006
-+++ dir.c Thu Jul 13 01:49:53 2006
-@@ -325,7 +325,17 @@
- rb_raise(rb_eIOError, "closed directory");
- }
-
-+static void
-+dir_check(dir)
-+ VALUE dir;
-+{
-+ if (!OBJ_TAINTED(dir) && rb_safe_level() >= 4)
-+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted Dir");
-+ rb_check_frozen(dir);
-+}
-+
- #define GetDIR(obj, dirp) do {\
-+ dir_check(dir);\
- Data_Get_Struct(obj, struct dir_data, dirp);\
- if (dirp->dir == NULL) dir_closed();\
- } while (0)
-@@ -535,6 +545,9 @@
- {
- struct dir_data *dirp;
-
-+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(dir)) {
-+ rb_raise(rb_eSecurityError, "Insecure: can't close");
-+ }
- GetDIR(dir, dirp);
- closedir(dirp->dir);
- dirp->dir = NULL;
diff --git a/lang/ruby18/files/patch-eval.c b/lang/ruby18/files/patch-eval.c
deleted file mode 100644
index 8f4b1f242009..000000000000
--- a/lang/ruby18/files/patch-eval.c
+++ /dev/null
@@ -1,129 +0,0 @@
-Index: eval.c
-diff -u -p eval.c.orig eval.c
---- eval.c.orig Tue Dec 20 22:41:47 2005
-+++ eval.c Mon Jan 23 10:01:51 2006
-@@ -108,7 +108,7 @@ rb_jump_context(env, val)
- abort(); /* ensure noreturn */
- }
- /*
-- * FUNCTION_CALL_MAY_RETURN_TWICE is a magic for getcontext, gcc,
-+ * PRE_GETCONTEXT and POST_GETCONTEXT is a magic for getcontext, gcc,
- * IA64 register stack and SPARC register window combination problem.
- *
- * Assume following code sequence.
-@@ -129,42 +129,88 @@ rb_jump_context(env, val)
- * But it has not the problem because gcc knows setjmp may return twice.
- * gcc detects setjmp and generates setjmp safe code.
- *
-- * So setjmp call before getcontext call makes the code somewhat safe.
-+ * So setjmp calls before and after the getcontext call makes the code
-+ * somewhat safe.
- * It fix the problem on IA64.
- * It is not required that setjmp is called at run time, since the problem is
- * register usage.
- *
- * Since the magic setjmp is not enough for SPARC,
- * inline asm is used to prohibit registers in register windows.
-- */
--#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
--#define FUNCTION_CALL_MAY_RETURN_TWICE \
-- ({ __asm__ volatile ("" : : : \
-- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
-- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
--#else
-+ *
-+ * Since the problem is fixed at gcc 4.0.3, the magic is applied only for
-+ * prior versions of gcc.
-+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21957
-+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22127
-+ */
-+# define GCC_VERSION_BEFORE(major, minor, patchlevel) \
-+ (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
-+ ((__GNUC__ < (major)) || \
-+ (__GNUC__ == (major) && __GNUC_MINOR__ < (minor)) || \
-+ (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ < (patchlevel))))
-+# if GCC_VERSION_BEFORE(4,0,3) && (defined(sparc) || defined(__sparc__))
-+# ifdef __pic__
-+/*
-+ * %l7 is excluded for PIC because it is PIC register.
-+ * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
-+ */
-+# define PRE_GETCONTEXT \
-+ ({ __asm__ volatile ("" : : : \
-+ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
-+ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-+# else
-+# define PRE_GETCONTEXT \
-+ ({ __asm__ volatile ("" : : : \
-+ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
-+ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-+# endif
-+# define POST_GETCONTEXT PRE_GETCONTEXT
-+# elif GCC_VERSION_BEFORE(4,0,3) && defined(__ia64)
- static jmp_buf function_call_may_return_twice_jmp_buf;
--int function_call_may_return_twice_false = 0;
--#define FUNCTION_CALL_MAY_RETURN_TWICE \
-- (function_call_may_return_twice_false ? \
-- setjmp(function_call_may_return_twice_jmp_buf) : \
-- 0)
--#endif
--#define ruby_longjmp(env, val) rb_jump_context(env, val)
--#define ruby_setjmp(j) ((j)->status = 0, \
-- FUNCTION_CALL_MAY_RETURN_TWICE, \
-- getcontext(&(j)->context), \
-- (j)->status)
-+int function_call_may_return_twice_false_1 = 0;
-+int function_call_may_return_twice_false_2 = 0;
-+# define PRE_GETCONTEXT \
-+ (function_call_may_return_twice_false_1 ? \
-+ setjmp(function_call_may_return_twice_jmp_buf) : \
-+ 0)
-+# define POST_GETCONTEXT \
-+ (function_call_may_return_twice_false_2 ? \
-+ setjmp(function_call_may_return_twice_jmp_buf) : \
-+ 0)
-+# elif defined(__FreeBSD__)
-+/*
-+ * workaround for FreeBSD/i386 getcontext/setcontext bug.
-+ * clear the carry flag by (0 ? ... : ...).
-+ * FreeBSD PR 92110 http://www.freebsd.org/cgi/query-pr.cgi?pr=92110
-+ * [ruby-dev:28263]
-+ */
-+static int volatile freebsd_clear_carry_flag = 0;
-+# define PRE_GETCONTEXT \
-+ (freebsd_clear_carry_flag ? (freebsd_clear_carry_flag = 0) : 0)
-+# endif
-+# ifndef PRE_GETCONTEXT
-+# define PRE_GETCONTEXT 0
-+# endif
-+# ifndef POST_GETCONTEXT
-+# define POST_GETCONTEXT 0
-+# endif
-+# define ruby_longjmp(env, val) rb_jump_context(env, val)
-+# define ruby_setjmp(j) ((j)->status = 0, \
-+ PRE_GETCONTEXT, \
-+ getcontext(&(j)->context), \
-+ POST_GETCONTEXT, \
-+ (j)->status)
- #else
- typedef jmp_buf rb_jmpbuf_t;
--#if !defined(setjmp) && defined(HAVE__SETJMP)
--#define ruby_setjmp(env) _setjmp(env)
--#define ruby_longjmp(env,val) _longjmp(env,val)
--#else
--#define ruby_setjmp(env) setjmp(env)
--#define ruby_longjmp(env,val) longjmp(env,val)
--#endif
-+# if !defined(setjmp) && defined(HAVE__SETJMP)
-+# define ruby_setjmp(env) _setjmp(env)
-+# define ruby_longjmp(env,val) _longjmp(env,val)
-+# else
-+# define ruby_setjmp(env) setjmp(env)
-+# define ruby_longjmp(env,val) longjmp(env,val)
-+# endif
- #endif
-
- #include <sys/types.h>
diff --git a/lang/ruby18/files/patch-eval.c-security b/lang/ruby18/files/patch-eval.c-security
deleted file mode 100644
index 37f0212396a4..000000000000
--- a/lang/ruby18/files/patch-eval.c-security
+++ /dev/null
@@ -1,35 +0,0 @@
---- eval.c.orig Thu Jul 13 01:48:12 2006
-+++ eval.c Thu Jul 13 01:49:37 2006
-@@ -2050,7 +2050,8 @@
- }
- }
- st_insert(RCLASS(klass)->m_tbl, name,
-- (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
-+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin),
-+ NOEX_WITH_SAFE(orig->nd_noex)));
- if (singleton) {
- rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
- }
-@@ -5561,6 +5562,11 @@
- TMP_PROTECT;
- volatile int safe = -1;
-
-+ if (NOEX_SAFE(flags) > ruby_safe_level &&
-+ !(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
-+ rb_raise(rb_eSecurityError, "calling insecure method: %s",
-+ rb_id2name(id));
-+ }
- switch (ruby_iter->iter) {
- case ITER_PRE:
- itr = ITER_CUR;
-@@ -5664,10 +5670,6 @@
- b2 = body = body->nd_next;
-
- if (NOEX_SAFE(flags) > ruby_safe_level) {
-- if (!(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
-- rb_raise(rb_eSecurityError, "calling insecure method: %s",
-- rb_id2name(id));
-- }
- safe = ruby_safe_level;
- ruby_safe_level = NOEX_SAFE(flags);
- }
diff --git a/lang/ruby18/files/patch-ext-dbm-extconf.rb b/lang/ruby18/files/patch-ext-dbm-extconf.rb
new file mode 100644
index 000000000000..11925747c5d0
--- /dev/null
+++ b/lang/ruby18/files/patch-ext-dbm-extconf.rb
@@ -0,0 +1,11 @@
+--- ext/dbm/extconf.rb.orig Sat Aug 26 20:04:57 2006
++++ ext/dbm/extconf.rb Sat Aug 26 21:48:20 2006
+@@ -55,7 +55,7 @@
+
+ have_header("cdefs.h")
+ have_header("sys/cdefs.h")
+-if /DBM_HDR/ =~ $CFLAGS and have_func(db_prefix("dbm_open"))
++if $defs.each { |d| /DBM_HDR/ =~ d } and have_func(db_prefix("dbm_open"))
+ have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
+ create_makefile("dbm")
+ end
diff --git a/lang/ruby18/files/patch-fileutils.rb b/lang/ruby18/files/patch-fileutils.rb
deleted file mode 100644
index 93930cd4c5b6..000000000000
--- a/lang/ruby18/files/patch-fileutils.rb
+++ /dev/null
@@ -1,10 +0,0 @@
---- lib/fileutils.rb.orig Sun Nov 20 02:23:41 2005
-+++ lib/fileutils.rb Mon Jan 16 02:08:47 2006
-@@ -501,6 +501,7 @@
- File.rename s, d
- rescue Errno::EXDEV
- copy_entry s, d, true
-+ File.unlink s
- end
- rescue SystemCallError
- raise unless options[:force]
diff --git a/lang/ruby18/files/patch-re.c-security b/lang/ruby18/files/patch-re.c-security
deleted file mode 100644
index 12057bf7b543..000000000000
--- a/lang/ruby18/files/patch-re.c-security
+++ /dev/null
@@ -1,11 +0,0 @@
---- re.c.orig Thu Jul 13 01:48:12 2006
-+++ re.c Thu Jul 13 01:49:45 2006
-@@ -1330,6 +1330,8 @@
- {
- struct RRegexp *re = RREGEXP(obj);
-
-+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
-+ rb_raise(rb_eSecurityError, "Insecure: can't modify regexp");
- if (re->ptr) re_free_pattern(re->ptr);
- if (re->str) free(re->str);
- re->ptr = 0;