summaryrefslogtreecommitdiff
path: root/version.h
AgeCommit message (Collapse)Author
2025-03-26bump teenyv3_2_8Hiroshi SHIBATA
2025-03-13merge revision(s) da4464b824857d7610f9865ceb452ce0ead49164: [Backport #19426]Hiroshi SHIBATA
[Bug #19426] Fix endless `Range#step` with `#succ` method
2025-03-13merge revision(s) 79eb75a8dd64848f23e9efc465f06326b5d4b680: [Backport #20025]Hiroshi SHIBATA
[Bug #20025] Check if upper/lower before fallback to case-folding
2025-03-13merge revision(s) 08b3a45bc97c835b4677bf76dbce68fd51d81897: [Backport #21180]Hiroshi SHIBATA
Push a real iseq in rb_vm_push_frame_fname() Previously, vm_make_env_each() (used during proc creation and for the debug inspector C API) picked up the non-GC-allocated iseq that rb_vm_push_frame_fname() creates, which led to a SEGV when the GC tried to mark the non GC object. Put a real iseq imemo instead. Speed should be about the same since the old code also did a imemo allocation and a malloc allocation. Real iseq allows ironing out the special-casing of dummy frames in rb_execution_context_mark() and rb_execution_context_update(). A check is added to RubyVM::ISeq#eval, though, to stop attempts to run dummy iseqs. [Bug #21180] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-03-13merge revision(s) bccec7fb468ad977be75e7e4c2644b4ea845ab0c, ↵Hiroshi SHIBATA
5f8ebcada099351acbc22db264e7cd3773c2bdc4, e13575bb7938e9e5b6a79bfca1b3793123f479da, 4adcfc8cd7a17593a6590025da2b03eebf4fd63c: [Backport #19584] Fix crash in rb_gc_register_address [Bug #19584] Some C extensions pass a pointer to a global variable to rb_gc_register_address. However, if a GC is triggered inside of rb_gc_register_address, then the object could get swept since it does not exist on the stack. [Bug #19584] Register global variable address before assignment [Bug #19584] Register global variables before assignment [Bug #19584] [DOC] Tweek description of `rb_gc_register_address`
2025-03-13merge revision(s) f423f6e10c0c226dfed98e7cb7a5d489191dfa35: [Backport #21131]Hiroshi SHIBATA
Ensure IO.copy_stream buffer is an independent string Otherwise, changes to the buffer by the destination write method could result in data changing for supposedly independent strings. Fixes [Bug #21131]
2025-03-13merge revision(s) d4a1a2780c39bc648496ac92fc6e6ce2eb38ab47: [Backport #21032]Hiroshi SHIBATA
rb_feature_p: skip `get_expanded_load_path` for absolute paths Ref: https://github.com/fxn/zeitwerk/pull/308 ```ruby require 'benchmark' $LOAD_PATH << 'relative-path' autoload :FOO, '/tmp/foo.rb' puts Benchmark.realtime { 500_000.times do Object.autoload?(:FOO) end } ``` The above script takes 2.5 seconds on `master`, and only 50ms on this branch. When we're looking for a feature with an absolute path, we don't need to call the expensive `get_expanded_load_path`.
2025-03-13merge revision(s) 647390308239fbf82d159ecd83ed8df090af518d: [Backport #18257]Hiroshi SHIBATA
[Bug #18257] Register the class path of FrozenCore to mark ICLASS does not have the path usually, so it needs to be registered separately.
2025-03-10merge revision(s) 3f07bc76ff6a11232d9f18e5eaa31835c195e8f0, ↵Hiroshi SHIBATA
34098b669c0cbc024cd08e686891f1dfe0a10aaf: [Backport #21144] [Bug #21144] Win32: Use Windows time zone ID if TZ is not set If the TZ environment variable is not set, the time zone names retrieved from the system are localized for UI display and may vary across editions and language packs for the same time zone. Use the time zone IDs that are invariant across environments instead. [Bug #21144] Win32: Convert the time zone name to the current locale The Windows time zone IDs provided by Microsoft as of 24H1 are ASCII only all, but the API itself is not impossible to set non-ASCII key name. Prefer the current locale encoding for now until we move to UTF-8 including environment variables and command line arguments.
2025-02-28merge revision(s) 2b6fc9ea7212543a1be26768403f59c7a759b5ea: [Backport #21092]Hiroshi SHIBATA
[Bug #21092] Fallback variables after execonf has done When reading from a dummy makefile, the global variables initialized in `init_mkmf` may not be overridden. --- ext/extmk.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
2025-02-04bump teenyv3_2_7nagachika
2025-01-25merge revision(s) dd80d9b089e35729d585bae2f8866c845c48f3b7: [Backport #20997]nagachika
YJIT: Filter `&` calls from specialized C method codegen Evident with the crash reported in [Bug #20997], the C replacement codegen functions aren't authored to handle block arguments (nor should they because the extra code from the complexity defeats optimization). Filter sites with VM_CALL_ARGS_BLOCKARG.
2025-01-25merge revision(s) 04ec07794657cd2444ecb001a522b9df2db1b90a: [Backport #21038]nagachika
Preserve `errno` in `rb_fiber_scheduler_unblock`. (#12576) [Bug #21038] Co-authored-by: Julian Scheid <julians37@gmail.com>
2025-01-25merge revision(s) e0d600ec190c64aff76cfcbd6009cffb927da166: [Backport #21012]nagachika
Avoid opt_aset_with optimization inside multiple assignment Previously, since the opt_aset_with optimization was introduced, use of the opt_aset_with optimization inside multiple assignment would result in a segfault or incorrect instructions. Fixes [Bug #21012] Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
2025-01-11merge revision(s) b176d4f52e4af67654814dab3e9c5f4bf9170e54: [Backport #21008]nagachika
[Bug #21008] Normalize before sum to float After switching to `Float`-mode when summing `Numeric` objects, normalization for `Float` is still needed.
2025-01-11merge revision(s) 8034e9c3d001ca3dff124ab42972684eac8af2ae: [Backport #20995]nagachika
[Bug #20995] Protect `IO.popen` block from exiting by exception
2025-01-11merge revision(s) 19c39e4cfaa467e69b9848c9c5496d7f50d39c7f, ↵nagachika
d78ff6a767ca813ac5fa178dd7611f20a993c191: [Backport #20984] [Bug #20984] ENV.inspect should be encoding aware [Bug #20984] Fix test with locale encoding
2024-12-21merge revision(s) a1758fbd7fe7406601b0eb1617752db59b83586a:nagachika
Crash when malloc during GC This feature was introduced in commit 2ccf6e5, but I realized that using rb_warn is a bad idea because it allocates objects, which causes a different crash ("object allocation during garbage collection phase"). We should just hard crash here instead.
2024-12-15merge revision(s) e90b447655dd39ad1eb645cdaae450efd605db00: [Backport #20924]nagachika
[Bug #20924] Fix reading with delimiter in wide character encodings
2024-12-15merge revision(s) 055613fd868a8c94e43893f8c58a00cdd2a81f6d: [Backport #20447]nagachika
Fix pointer incompatiblity Since the subsecond part is discarded, WIDEVAL to VALUE conversion is needed.
2024-12-15merge revision(s) 660b995365f719fa59ed6f2809bb1527e6470d14: [Backport #20915]nagachika
[Bug #20915] Fix SEGV with `TracePoint#parameters` and aliased C method The following snippet results with a SEGV: ```ruby C = Class.new do alias_method :new_to_s, :to_s end TracePoint.new(:c_call, &:parameters).enable { C.new.new_to_s } ``` at MRI 3.3.6 and ruby 3.4.0dev The root cause of the issue lies in the `rb_tracearg_parameters` function within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked method is an alias for a C function, `rb_method_entry_without_refinements(..., trace_arg->called_id, ...)` may return NULL. In that case we can fallback to `trace_arg->id`.
2024-12-15merge revision(s) f65a6c090c229de1665af49f2e51fc1d6397ab72: [Backport #20921]nagachika
Fix use-after-free in constant cache [Bug #20921] When we create a cache entry for a constant, the following sequence of events could happen: - vm_track_constant_cache is called to insert a constant cache. - In vm_track_constant_cache, we first look up the ST table for the ID of the constant. Assume the ST table exists because another iseq also holds a cache entry for this ID. - We then insert into this ST table with the iseq_inline_constant_cache. - However, while inserting into this ST table, it allocates memory, which could trigger a GC. Assume that it does trigger a GC. - The GC frees the one and only other iseq that holds a cache entry for this ID. - In remove_from_constant_cache, it will appear that the ST table is now empty because there are no more iseq with cache entries for this ID, so we free the ST table. - We complete GC and continue our st_insert. However, this ST table has been freed so we now have a use-after-free. This issue is very hard to reproduce, because it requires that the GC runs at a very specific time. However, we can make it show up by applying this patch which runs GC right before the st_insert to mimic the st_insert triggering a GC: diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 3cb23f06f0..a93998136a 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -6338,6 +6338,10 @@ vm_track_constant_cache(ID id, void *ic) rb_id_table_insert(const_cache, id, (VALUE)ics); } + if (id == rb_intern("MyConstant")) rb_gc(); + st_insert(ics, (st_data_t) ic, (st_data_t) Qtrue); } And if we run this script: Object.const_set("MyConstant", "Hello!") my_proc = eval("-> { MyConstant }") my_proc.call my_proc = eval("-> { MyConstant }") my_proc.call We can see that ASAN outputs a use-after-free error: ==36540==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000049528 at pc 0x000102f3ceac bp 0x00016d607a70 sp 0x00016d607a68 READ of size 8 at 0x606000049528 thread T0 #0 0x102f3cea8 in do_hash st.c:321 #1 0x102f3ddd0 in rb_st_insert st.c:1132 #2 0x103140700 in vm_track_constant_cache vm_insnhelper.c:6345 #3 0x1030b91d8 in vm_ic_track_const_chain vm_insnhelper.c:6356 #4 0x1030b8cf8 in rb_vm_opt_getconstant_path vm_insnhelper.c:6424 #5 0x1030bc1e0 in vm_exec_core insns.def:263 #6 0x1030b55fc in rb_vm_exec vm.c:2585 #7 0x1030fe0ac in rb_iseq_eval_main vm.c:2851 #8 0x102a82588 in rb_ec_exec_node eval.c:281 #9 0x102a81fe0 in ruby_run_node eval.c:319 #10 0x1027f3db4 in rb_main main.c:43 #11 0x1027f3bd4 in main main.c:68 #12 0x183900270 (<unknown module>) 0x606000049528 is located 8 bytes inside of 56-byte region [0x606000049520,0x606000049558) freed by thread T0 here: #0 0x104174d40 in free+0x98 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x54d40) #1 0x102ada89c in rb_gc_impl_free default.c:8183 #2 0x102ada7dc in ruby_sized_xfree gc.c:4507 #3 0x102ac4d34 in ruby_xfree gc.c:4518 #4 0x102f3cb34 in rb_st_free_table st.c:663 #5 0x102bd52d8 in remove_from_constant_cache iseq.c:119 #6 0x102bbe2cc in iseq_clear_ic_references iseq.c:153 #7 0x102bbd2a0 in rb_iseq_free iseq.c:166 #8 0x102b32ed0 in rb_imemo_free imemo.c:564 #9 0x102ac4b44 in rb_gc_obj_free gc.c:1407 #10 0x102af4290 in gc_sweep_plane default.c:3546 #11 0x102af3bdc in gc_sweep_page default.c:3634 #12 0x102aeb140 in gc_sweep_step default.c:3906 #13 0x102aeadf0 in gc_sweep_rest default.c:3978 #14 0x102ae4714 in gc_sweep default.c:4155 #15 0x102af8474 in gc_start default.c:6484 #16 0x102afbe30 in garbage_collect default.c:6363 #17 0x102ad37f0 in rb_gc_impl_start default.c:6816 #18 0x102ad3634 in rb_gc gc.c:3624 #19 0x1031406ec in vm_track_constant_cache vm_insnhelper.c:6342 #20 0x1030b91d8 in vm_ic_track_const_chain vm_insnhelper.c:6356 #21 0x1030b8cf8 in rb_vm_opt_getconstant_path vm_insnhelper.c:6424 #22 0x1030bc1e0 in vm_exec_core insns.def:263 #23 0x1030b55fc in rb_vm_exec vm.c:2585 #24 0x1030fe0ac in rb_iseq_eval_main vm.c:2851 #25 0x102a82588 in rb_ec_exec_node eval.c:281 #26 0x102a81fe0 in ruby_run_node eval.c:319 #27 0x1027f3db4 in rb_main main.c:43 #28 0x1027f3bd4 in main main.c:68 #29 0x183900270 (<unknown module>) previously allocated by thread T0 here: #0 0x104174c04 in malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x54c04) #1 0x102ada0ec in rb_gc_impl_malloc default.c:8198 #2 0x102acee44 in ruby_xmalloc gc.c:4438 #3 0x102f3c85c in rb_st_init_table_with_size st.c:571 #4 0x102f3c900 in rb_st_init_table st.c:600 #5 0x102f3c920 in rb_st_init_numtable st.c:608 #6 0x103140698 in vm_track_constant_cache vm_insnhelper.c:6337 #7 0x1030b91d8 in vm_ic_track_const_chain vm_insnhelper.c:6356 #8 0x1030b8cf8 in rb_vm_opt_getconstant_path vm_insnhelper.c:6424 #9 0x1030bc1e0 in vm_exec_core insns.def:263 #10 0x1030b55fc in rb_vm_exec vm.c:2585 #11 0x1030fe0ac in rb_iseq_eval_main vm.c:2851 #12 0x102a82588 in rb_ec_exec_node eval.c:281 #13 0x102a81fe0 in ruby_run_node eval.c:319 #14 0x1027f3db4 in rb_main main.c:43 #15 0x1027f3bd4 in main main.c:68 #16 0x183900270 (<unknown module>) This commit fixes this bug by adding a inserting_constant_cache_id field to the VM, which stores the ID that is currently being inserted and, in remove_from_constant_cache, we don't free the ST table for ID equal to this one. Co-Authored-By: Alan Wu <alanwu@ruby-lang.org>
2024-11-30merge revision(s) 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc, ↵nagachika
6b4f8945d600168bf530d21395da8293fbd5e8ba: [Backport #20909] Check negative integer underflow Many of Oniguruma functions need valid encoding strings
2024-11-30merge revision(s) a8c2d5e7bee5fad0965baeb58d312ddc5932ec26: [Backport #20907]nagachika
Ensure fiber scheduler re-acquires mutex when interrupted from sleep. (#12158) [Bug #20907]
2024-11-30merge revision(s) 3b7892b6e4d1a1a5d6019987f9b46ed443dd104f: [Backport #20871]nagachika
Fix a bug in rb_include_module that stops nested inclusion into module subclasses This bug was present since the code was originally added by me in 3556a834a2847e52162d1d3302d4c64390df1694. Fixes [Bug #20871]
2024-11-30merge revision(s) 0d4de0f4b1b9ac90be437bf1bac6851dd1d96fd0: [Backport #20898]nagachika
wasm: align fiber stack pointer to 16 bytes In WebAssembly C ABI, the linear stack pointer must be always aligned to 16 bytes like other archs. The misaligned stack pointer causes some weird memory corruption since compiler assumes the aligned stack pointer.
2024-11-10merge revision(s) d71be7274bd2623bb521be72c245c08fc38d6ae4: [Backport #20873]nagachika
[Bug #20873] Consider `-FIXNUM_MIN` overflow `-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using two's complement representation.
2024-11-10merge revision(s) 56ecc243e230e8e99761ec0ffc5116601f094bb0: [Backport #20868]nagachika
[Bug #20868] Fix Method#hash to not change after compaction The hash value of a Method must remain constant after a compaction, otherwise it may not work as the key in a hash table. For example: def a; end # Need this method here because otherwise the iseq may be on the C stack # which would get pinned and not move during compaction def get_hash method(:a).hash end puts get_hash # => 2993401401091578131 GC.verify_compaction_references(expand_heap: true, toward: :empty) puts get_hash # => -2162775864511574135
2024-11-10merge revision(s) 29c480dd6fca993590c82078ba797e2c4e876ac7: [Backport #20853]nagachika
[Bug #20853] Fix Proc#hash to not change after compaction The hash value of a Proc must remain constant after a compaction, otherwise it may not work as the key in a hash table.
2024-10-30bump teenyv3_2_6nagachika
2024-10-28merge revision(s) 70d20ce473952e3a2e5b0aa4a6884886517ee3cc:nagachika
Update bundled gems list
2024-10-20merge revision(s) ce20367a0e2f1fcfabebf3b6bea732fc71fa79f7: [Backport #20500]nagachika
Define `incflags` also on mswin
2024-10-20merge revision(s) bcb3247072e6973d0f6b50ca5fed238d5824bd28: [Backport #20500]nagachika
[Bug #19778] Pass additional include options to INCFLAGS in common.mk
2024-10-20merge revision(s) 5fa6ba9568e87e43e08a4daeba1572254c589fb1: [Backport #20500]nagachika
[Bug #20500] Search non-default directories for jemalloc Co-Authored-by: lish82 (Hiroki Katagiri)
2024-10-18merge revision(s) 6118e8a47394409b53164b60e79fadf348b97db3, ↵nagachika
dc64448202299633a235f310b8bf2192263f274f: [Backport #20716] Fix method caching bug when including/prepend module A that prepends module B Fix by always adding the generated iclass to the subclasses list, otherwise the method cache for the iclass is not cleared when the method in the module is overwritten. Fixes [Bug #20716] Remove an unused variable
2024-10-18merge revision(s) 35e124832e29b65c84d4e0e4e434616859f9bdf5: [Backport #20755]nagachika
[Bug #20755] Frozen string should not be writable via IO::Buffer
2024-10-18merge revision(s) 637067440f74043c6d79fc649ab8acf1afea25a5: [Backport #20752]nagachika
[Bug #20752] Slice of readonly `IO::Buffer` also should be readonly
2024-10-18merge revision(s) c1862cbb89a6bf42dcd07d92fe4f4bfeebca5775: [Backport #20719]nagachika
[Bug #20719] `Float` argument must be ASCII compatible
2024-10-18merge revision(s) d33e3d47b84a73b38644f2a3d41881ce9be6ef18: [Backport #20704]nagachika
[Bug #20704] Win32: Fix chdir to non-ASCII path On Windows, `chdir` in compilers' runtime libraries uses the active code page, but command line arguments in ruby are always UTF-8, since commit:33ea2646b98adb49ae2e1781753bf22d33729ac0.
2024-09-26merge revision(s) 0d16c36d0ab2afa2ec79b72b229e69c141ebdaba: [Backport #13831]nagachika
[win32/registry] Fallback to UTF-8 for unknown codepages There are some codepages like cp708 for which no ruby encoding exists: $ ruby -e "Encoding.find('cp708')" Traceback (most recent call last): 1: from -e:1:in `<main>' -e:1:in `find': unknown encoding name - cp708 (ArgumentError) win32/registry uses ENCODING to transcode error messages and expand environment variables from UTF-16LE, so using UTF-8 seems like the best choice and is better than a hard failure. This should resolve [Bug #13831]
2024-08-31merge revision(s) 29500e3034681a30045dea462d6bb653e8600738: [Backport #20698]nagachika
Update bundled gems list as of 2024-08-22
2024-08-31merge revision(s) bb849ffdb18305f01457de4e9848c830eb83a2d7:nagachika
Added explicitly begin-end block for Ruby 2.4. strscan, ipaddr and some default gems still support Ruby 2.4. After this, I extract this CoreAssertions to their repositories.
2024-08-31merge revision(s) 8a7e6f6852740e989ef8f679db5631306466a4ed:nagachika
Improve base time of assert_linear_performance (#11369) Remove `.ceil` from base time calculation that makes 10x gap. This will make the assertion more strict and also less flaky.
2024-08-31merge revision(s) f1c78b23313e63eb31a213cc7277b1eb206a581b:nagachika
Suppress warning for shadowing outer local variable
2024-08-31merge revision(s) d23964360335ad561f252cb6fe8e90df7ebee90e:nagachika
core_assertions.rb: Support old rubies Some symbol argument might not be accepted by Process.clock_gettime.
2024-08-31merge revision(s) 533423ebe46ebfe3005198c12aa0d2c899c695ea:nagachika
core_assertions.rb: Prefer CPU time clocks To prevent influence from other processes.
2024-08-31merge revision(s) f9eb2515a3221cced611b4de971b72a78a7a566f:nagachika
core_assertions.rb: Extract common code block
2024-08-31merge revision(s) 3fe134759cc4904c74306e0832c22fa518a5bea2:nagachika
Skip assert_linear_performance for RJIT
2024-08-31merge revision(s) f07c756494b0e473ff8e4ece6f04c7ababe93b01:nagachika
core_assertions.rb: Tweak timeout limit Increase the timeout limit when variance at rehearsal is small.
2024-08-27Revert "merge revision(s) 29500e3034681a30045dea462d6bb653e8600738: ↵nagachika
[Backport #20698]" This reverts commit 3a3784a197383046537e66a9c567b96a52f0f86f.