ruby-changes:28164
From: naruse <ko1@a...>
Date: Thu, 11 Apr 2013 03:35:34 +0900 (JST)
Subject: [ruby-changes:28164] naruse:r40216 (trunk): * ext/fiddle/closure.c (initialize): check mprotect's return value.
naruse 2013-04-11 03:35:21 +0900 (Thu, 11 Apr 2013) New Revision: 40216 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40216 Log: * ext/fiddle/closure.c (initialize): check mprotect's return value. If mprotect is failed because of PaX or something, its function call will cause SEGV. http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130401T210301Z.diff.html.gz Modified files: trunk/ChangeLog trunk/ext/fiddle/closure.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40215) +++ ChangeLog (revision 40216) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Apr 11 03:33:05 2013 NARUSE, Yui <naruse@r...> + + * ext/fiddle/closure.c (initialize): check mprotect's return value. + If mprotect is failed because of PaX or something, its function call + will cause SEGV. + http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20130401T210301Z.diff.html.gz + Wed Apr 10 17:39:13 2013 Tanaka Akira <akr@f...> * ext/bigdecimal/bigdecimal.c (VpCtoV): Initialize a local variable Index: ext/fiddle/closure.c =================================================================== --- ext/fiddle/closure.c (revision 40215) +++ ext/fiddle/closure.c (revision 40216) @@ -228,7 +228,10 @@ initialize(int rbargc, VALUE argv[], VAL https://github.com/ruby/ruby/blob/trunk/ext/fiddle/closure.c#L228 #else result = ffi_prep_closure(pcl, cif, callback, (void *)self); cl->code = (void *)pcl; - mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC); + i = mprotect(pcl, sizeof(pcl), PROT_READ | PROT_EXEC); + if (i) { + rb_sys_fail("mprotect"); + } #endif if (FFI_OK != result) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/