mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Force disable yjit on OpenBSD
TestRubyOptions#test_enable was broken on OpenBSD after the yjit merge. --yjit (and --enable-all, which enables --yjit) fails on OpenBSD because yjit uses an insecure mmap call (both writable and executable), in alloc_exec_mem, which OpenBSD does not allow. This can probably be reverted if yjit switches to a more secure mmap design (writable xor executable). This would involve initially calling mmap with PROT_READ | PROT_WRITE, and after writing of executable code has finished, using mprotect to switch to PROT_READ | PROT_EXEC. I believe Firefox uses this approach for their Javascript engine since Firefox 46.
This commit is contained in:
parent
d74f1e1623
commit
119626da94
1 changed files with 6 additions and 0 deletions
6
ruby.c
6
ruby.c
|
@ -1871,6 +1871,12 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
||||||
*/
|
*/
|
||||||
rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior");
|
rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior");
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
/* Disable yjit on OpenBSD, stops --enable-all from failing with:
|
||||||
|
mmap call failed: Not supported */
|
||||||
|
opt->features.set &= ~FEATURE_BIT(yjit);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if USE_MJIT
|
#if USE_MJIT
|
||||||
if (opt->features.set & FEATURE_BIT(jit)) {
|
if (opt->features.set & FEATURE_BIT(jit)) {
|
||||||
opt->mjit.on = TRUE; /* set mjit.on for ruby_show_version() API and check to call mjit_init() */
|
opt->mjit.on = TRUE; /* set mjit.on for ruby_show_version() API and check to call mjit_init() */
|
||||||
|
|
Loading…
Reference in a new issue