summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 01:11:47 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 01:11:47 +0000
commitd1dfebc05a0af85d6dac21038662a794464ff0e8 (patch)
tree0e640bd78d9fe646c3a363a81606f8df8b289deb /thread.c
parente2779a53ef78eddfe464fc5c9821e7c43f061597 (diff)
Revert r37953: thread.c (thread_start_func_2): remove unused code. security
This sticks at bootstraptest/test_fork.rb:24 on FreeBSD and darwin. http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20121128T230302Z.log.html.gz http://a.mrkn.jp/~mrkn/chkbuild/sl/ruby-trunk-m64-gcc42-o0/log/20121128T235908Z.log.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index a56f264a6c..a75990ccfb 100644
--- a/thread.c
+++ b/thread.c
@@ -491,8 +491,16 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
}
- else if (th->vm->thread_abort_on_exception ||
- th->abort_on_exception || RTEST(ruby_debug)) {
+ else if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
+ if (th->safe_level >= 4) {
+ th->errinfo = rb_exc_new3(rb_eSecurityError,
+ rb_sprintf("Insecure exit at level %d", th->safe_level));
+ errinfo = Qnil;
+ }
+ }
+ else if (th->safe_level < 4 &&
+ (th->vm->thread_abort_on_exception ||
+ th->abort_on_exception || RTEST(ruby_debug))) {
/* exit on main_thread */
}
else {