Skip to content

Merge upstream#65

Merged
maximecb merged 134 commits intomainfrom
merge_upstream
Jun 3, 2021
Merged

Merge upstream#65
maximecb merged 134 commits intomainfrom
merge_upstream

Conversation

@maximecb
Copy link
Contributor

@maximecb maximecb commented Jun 3, 2021

No description provided.

jeremyevans and others added 30 commits May 20, 2021 12:24
From Thibault Jouan

Fixes [Misc #17872]
So that no longer disturbed by C comment delimiters.
Remove GNU make `-O` and `-W` options which are short but followed
by an argument, so that `$mflags.set?(?n)` does not return `true`
wrongly.
RDoc seems still supporting outdated 2.4.

https://github.com/ruby/rdoc/runs/2565344070?check_suite_focus=true#step:5:64
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): NoMethodError: undefined method `children' for Dir:Class
/home/runner/work/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:467:in `block in test_remove_unparseable_CVE_2021_31799'
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
  => 467:       assert_equal file_list, Dir.children('.')
     468:     end
     469:   end
     470:
```

ruby/rdoc@5a4a64dc0f
No risk of remote code execution, when the file cannot be created.

https://github.com/ruby/rdoc/runs/2565343916?check_suite_focus=true#step:5:58
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): Errno::EINVAL: Invalid argument @ utime_failed - | touch evil.txt && echo tags
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `utime'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `block in touch'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `each'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `touch'
D:/a/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:463:in `block (2 levels) in test_remove_unparseable_CVE_2021_31799'
     460:     temp_dir do
     461:       file_list = ['| touch evil.txt && echo tags']
     462:       file_list.each do |f|
  => 463:         FileUtils.touch f
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
```

ruby/rdoc@a7df7dc8fa
Use test-unit assertions instead of minitest.

ruby/rdoc@d6a6209d7f
609de71 fixes the issue by using
`throw` insn if `ensure` is used. However, that patch introduce
additional `throw` even if it is not needed. This patch solves
the issue.

This issue is pointed by @mame.
Since refinement search is always performed, these entries should always
be public. The method entry that the refinement search returns decides
the visibility.

Fixes [Bug #17822]
Before this change, CDHASH operands were built as plain hashes when
loaded from binary. Without setting up the hash with the correct
st_table type, the hash can sometimes be an ar_table. When the hash is
an ar_table, lookups can call the `eql?` method on keys of the hash,
which makes the `opt_case_dispatch` instruction not "leaf" as it
implicitly declares.

The following script trips the stack canary for checking the leaf
attribute for `opt_case_dispatch` on VM_CHECK_MODE > 0 (enabled by
default with RUBY_DEBUG).

    rb_vm_iseq = RubyVM::InstructionSequence

    iseq = rb_vm_iseq.compile(<<-EOF)
      case Class.new(String).new("foo")
      when "foo"
        42
      end
    EOF

    puts rb_vm_iseq.load_from_binary(iseq.to_binary).eval

This commit changes the binary loading logic to build CDHASH with the
right st_table type. The dumping logic and the dump format stays the
same
If freezing an array inside sort!, previously the array could be
modified after the freeze.  This checks whether the receiver is
frozen after every yield and potential call to #> or #<,
preventing modifications if the receiver is frozen inside the
block or by the #> or #< call.

Fixes [Bug #17739]
The order of arguments to callback of qsort is not defined.
That means `a` may not be 3 at all.
I'd like to retry this kind of error, but showing no backtrace is hard
to deal with.
https://github.com/ruby/ruby/runs/2644908002
When `NO_COLOR` is set to any non-nil value, output is not colorized.

See https://no-color.org/

ruby/irb@401d0916fe
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

ruby/irb@2dfdc031ec
tenderlove and others added 27 commits June 1, 2021 15:25
Instead of keeping track of the current bit plane, keep track of the
actual slot when compacting.  This means we don't need to re-scan
objects inside the same bit plane when we continue with movement
https://github.com/ruby/ruby/runs/2707566811#step:10:147
```
D:\a\ruby\ruby\src\mjit_worker.c(1212): warning C4090: 'function': different 'const' qualifiers
```
and not for third-party libraries.

See: e6484a1
It's been a way too much amount of ifdefs.
We are only iterating over the eden heap so `heap_eden->total_pages`
contains the exact number of pages we need to allocate for.
`heap_allocated_pages` may contain pages in the tomb.
…avoid "test_" prefix

This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".

The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:

```
t.test_files = FileList['test/**/test_*.rb']
```

Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.

Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.

ruby/rubygems@6460e018df
because a SEGV might happen on an MJIT worker. As you can clearly see
from `if (vm && ec) {`, ec is not guaranteed to exist here.
This fixes SEGVs like https://github.com/ruby/ruby/runs/2715166621?check_suite_focus=true.

When mjit_recompile is called when mjit_compile is compiling the exact
same iseq (and after it called mjit_capture_cc_entries), iseq->body->jit_unit
is re-created and its cc_entries becomes NULL. Then, when it tries to
lookup cc_entries through iseq->body->jit_unit, it fails.
Following non-special_const literals:
* T_BIGNUM
* T_FLOAT (non-flonum)
* T_RATIONAL
* T_COMPLEX
Following non-special_const literals:
* T_REGEXP
This is a follow-up of 86c2625.
CRITICAL_SECTION_START/FINISH are not needed when it's called from an
MJIT worker.

Also, ZALLOC needs to be calloc because ZALLOC may trigger GC, which an
MJIT worker must not do.
@maximecb maximecb merged commit 7f91c57 into main Jun 3, 2021
@maximecb maximecb deleted the merge_upstream branch June 3, 2021 18:48
@maximecb maximecb restored the merge_upstream branch June 3, 2021 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.