summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-06-20 13:25:30 -0400
committerPeter Zhu <[email protected]>2024-06-21 11:49:01 -0400
commit90763e04ba2200f96a485d2ef3bb56817ae1b2db (patch)
treea5b9327ee455e0ab5ff25487f348aff3e39f98a6 /ruby.c
parentbd583ca645ea348a2894f4227fcb1af650ee8dec (diff)
Load external GC using command line argument
This commit changes the external GC to be loaded with the `--gc-library` command line argument instead of the RUBY_GC_LIBRARY_PATH environment variable because @nobu pointed out that loading binaries using environment variables can pose a security risk.
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index b452b0b1ef..fa64dc3caa 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1436,6 +1436,16 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **
set_source_encoding_once(opt, s, 0);
}
#endif
+#if defined(USE_SHARED_GC) && USE_SHARED_GC
+ else if (is_option_with_arg("gc-library", Qfalse, Qfalse)) {
+ // no-op
+ // Handled by ruby_load_external_gc_from_argv
+
+ if (!dln_supported_p()) {
+ rb_warn("--gc-library is ignored because this executable file can't load extension libraries");
+ }
+ }
+#endif
else if (strcmp("version", s) == 0) {
if (envopt) goto noenvopt_long;
opt->dump |= DUMP_BIT(version);