This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bignum.c b/bignum.c | |
index 97be53f..8939282 100644 | |
--- a/bignum.c | |
+++ b/bignum.c | |
@@ -2657,7 +2657,7 @@ rb_big_mul(VALUE x, VALUE y) | |
struct big_div_struct { | |
long nx, ny; | |
BDIGIT *yds, *zds; | |
- VALUE stop; | |
+ volatile VALUE stop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bignum.c b/bignum.c | |
index 8939282..262f2a3 100644 | |
--- a/bignum.c | |
+++ b/bignum.c | |
@@ -2666,7 +2666,8 @@ bigdivrem1(void *ptr) | |
struct big_div_struct *bds = (struct big_div_struct*)ptr; | |
long nx = bds->nx, ny = bds->ny; | |
long i, j, nyzero; | |
- BDIGIT *yds = bds->yds, *zds = bds->zds; | |
+ const BDIGIT *yds = bds->yds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/signal.c b/signal.c | |
index 9f1717e..ea82faf 100644 | |
--- a/signal.c | |
+++ b/signal.c | |
@@ -623,7 +623,6 @@ sigsegv(int sig SIGINFO_ARG) | |
static void | |
signal_exec(VALUE cmd, int safe, int sig) | |
{ | |
- VALUE signum = INT2NUM(sig); | |
rb_thread_t *cur_th = GET_THREAD(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/signal.c b/signal.c | |
index 7bf0404..ba19e6d 100644 | |
--- a/signal.c | |
+++ b/signal.c | |
@@ -627,7 +627,7 @@ signal_exec(VALUE cmd, int safe, int sig) | |
volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask; | |
int state; | |
- cur_th->interrupt_mask |= 0x08; | |
+ cur_th->interrupt_mask |= TRAP_INTERRUPT_MASK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/configure.in b/configure.in | |
index 7fa99c6..97855ea 100644 | |
--- a/configure.in | |
+++ b/configure.in | |
@@ -1086,6 +1086,22 @@ if test "$GCC" = yes; then | |
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS) | |
fi | |
+ AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_compiler_cas], [ | |
+ AC_TRY_LINK([unsigned long atomic_var;], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/thread.c b/thread.c | |
index af33c92..517583a 100644 | |
--- a/thread.c | |
+++ b/thread.c | |
@@ -65,7 +65,9 @@ VALUE rb_cThreadShield; | |
static void sleep_timeval(rb_thread_t *th, struct timeval time); | |
static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec); | |
+#if 0 | |
static void sleep_forever(rb_thread_t *th, int nodeadlock); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/thread.c b/thread.c | |
index af33c92..fb80ed3 100644 | |
--- a/thread.c | |
+++ b/thread.c | |
@@ -64,11 +64,11 @@ VALUE rb_cMutex; | |
VALUE rb_cThreadShield; | |
static void sleep_timeval(rb_thread_t *th, struct timeval time); | |
-static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec); | |
static void sleep_forever(rb_thread_t *th, int nodeadlock); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#0 0x00007ffff7ec3aea in st_lookup (table=0x7ffff7f1efc5, key=2832, value=0x7fffffffe280) at ../st.c:414 | |
#1 0x00007ffff7f03ad1 in classname (klass=140737356734640, permanent=0x7fffffffe2fc) at ../variable.c:168 | |
#2 0x00007ffff7f03c54 in rb_tmp_class_path (klass=140737356734640, permanent=0x7fffffffe2fc) at ../variable.c:217 | |
#3 0x00007ffff7f03dcb in rb_class_path (klass=140737356734640) at ../variable.c:252 | |
#4 0x00007ffff7f042c6 in rb_class_name (klass=140737356734640) at ../variable.c:354 | |
#5 0x00007ffff7f042e0 in rb_class2name (klass=140737356734640) at ../variable.c:360 | |
#6 0x00007ffff7f04329 in rb_obj_classname (obj=140737356742440) at ../variable.c:367 | |
#7 0x00007ffff7de8d33 in rb_builtin_class_name (x=140737356742440) at ../error.c:457 | |
#8 0x00007ffff7de8f09 in rb_check_typeddata (obj=140737356742440, data_type=0x7ffff8202020) at ../error.c:512 | |
#9 0x00007ffff7f4f779 in rb_fiber_reset_root_local_storage (thval=140737356742440) at ../cont.c:1379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/internal.h b/internal.h | |
index 86181f9..8f98f2d 100644 | |
--- a/internal.h | |
+++ b/internal.h | |
@@ -328,6 +328,7 @@ const char *rb_objspace_data_type_name(VALUE obj); | |
/* Temporary. This API will be removed (renamed). */ | |
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd); | |
+VALUE rb_thread_io_blocking_region2(rb_blocking_function_t *func, void *data1, int fd); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/thread.c b/thread.c | |
index a75990c..dae4194 100644 | |
--- a/thread.c | |
+++ b/thread.c | |
@@ -491,16 +491,15 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, | |
if (state == TAG_FATAL) { | |
/* fatal error within this thread, need to stop whole script * | |
} | |
+ else if (th->safe_level >= 4) { | |
+ /* Ignore it. Main thread shouldn't be harmed from untrusted t |