ruby-changes:70733
From: Peter <ko1@a...>
Date: Wed, 5 Jan 2022 04:46:34 +0900 (JST)
Subject: [ruby-changes:70733] 44379805b0 (master): Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stress
https://git.ruby-lang.org/ruby.git/commit/?id=44379805b0 From 44379805b0859179ed4c9fb68bb2e5e95720cc3a Mon Sep 17 00:00:00 2001 From: Peter Zhu <peter@p...> Date: Tue, 4 Jan 2022 13:54:21 -0500 Subject: Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stress We need to unshare the array loaded_features because the shared root could be old gen (while loaded_features is young) which causes a WB miss. --- ruby.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruby.c b/ruby.c index f63cecdb985..b17c29a5260 100644 --- a/ruby.c +++ b/ruby.c @@ -2062,7 +2062,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L2062 for (long i = loaded_before_enc; i < RARRAY_LEN(loaded_features); ++i) { VALUE path = RARRAY_AREF(loaded_features, i); if (!(path = copy_str(path, IF_UTF8_PATH(uenc, lenc), true))) continue; - modified = true; + if (!modified) { + rb_ary_modify(loaded_features); + modified = true; + } RARRAY_ASET(loaded_features, i, path); } if (modified) { -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/