ruby-changes:28739
From: nobu <ko1@a...>
Date: Fri, 17 May 2013 11:07:12 +0900 (JST)
Subject: [ruby-changes:28739] nobu:r40791 (trunk): eval_intern.h: jmpbuf must be accessible
nobu 2013-05-17 11:07:00 +0900 (Fri, 17 May 2013) New Revision: 40791 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40791 Log: eval_intern.h: jmpbuf must be accessible * eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before pushing tag to get rid of unaccessible tag by stack overflow. Modified files: trunk/ChangeLog trunk/eval_intern.h Index: eval_intern.h =================================================================== --- eval_intern.h (revision 40790) +++ eval_intern.h (revision 40791) @@ -91,9 +91,20 @@ extern int select_large_fdset(int, fd_se https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L91 rb_fiber_start(); \ } while (0) +/* + ensure tag to be accessible, `buf' is at the beginning. + the end is `prev' which is written in TH_PUSH_TAG(). +*/ +#if defined(__GNUC__) && __GNUC__ >= 4 +/* suppress -Wstrict-aliasing, and should be inlined */ +# define ENSURE_TAG_WRITABLE(tag) MEMZERO((tag).buf, int, 1) +#else +# define ENSURE_TAG_WRITABLE(tag) (*(volatile int *)(tag).buf = 0) +#endif #define TH_PUSH_TAG(th) do { \ rb_thread_t * const _th = (th); \ struct rb_vm_tag _tag; \ + ENSURE_TAG_WRITABLE(_tag); \ _tag.tag = 0; \ _tag.prev = _th->tag; \ _th->tag = &_tag; Index: ChangeLog =================================================================== --- ChangeLog (revision 40790) +++ ChangeLog (revision 40791) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri May 17 11:06:48 2013 Nobuyoshi Nakada <nobu@r...> + + * eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before + pushing tag to get rid of unaccessible tag by stack overflow. + Thu May 16 17:15:32 2013 NARUSE, Yui <naruse@r...> * vm_eval.c (rb_catch_obj): add volatile to tag to prevent crash -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/