<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_objectspace.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Add RVALUE_OVERHEAD and move ractor_belonging_id</title>
<updated>2022-11-21T16:26:26+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-11-18T15:07:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5f95228c76e6f6994eb4149217fe3e38f9ff8a27'/>
<id>5f95228c76e6f6994eb4149217fe3e38f9ff8a27</id>
<content type='text'>
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure _id2ref finds symbols with the correct type</title>
<updated>2022-07-20T17:38:44+00:00</updated>
<author>
<name>Daniel Colson</name>
<email>danieljamescolson@gmail.com</email>
</author>
<published>2022-07-03T00:28:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=32e406d6d3c3ded9160298c4475c1aa188360b07'/>
<id>32e406d6d3c3ded9160298c4475c1aa188360b07</id>
<content type='text'>
Prior to this commit it was possible to call `ObjectSpace._id2ref` with
an offset static symbol object_id and get back a new, incorrectly tagged
symbol:

```
&gt; sensible_sym = ObjectSpace._id2ref(:a.object_id)
=&gt; :a
&gt; nonsense_sym = ObjectSpace._id2ref(:a.object_id + 40)
=&gt; :a
&gt; sensible_sym == nonsense_sym
=&gt; false
```

`nonsense_sym` ends up tagged with `RUBY_ID_INSTANCE` instead of
`RB_ID_LOCAL`. That means we can do silly things like:

```
&gt; foo = Object.new
&gt; foo.instance_variable_set(:a, 123)
(irb):2:in `instance_variable_set': `a' is not allowed as an instance variable name (NameError)
&gt; foo.instance_variable_set(ObjectSpace._id2ref(:a.object_id + 40), 123)
=&gt; 123
&gt; foo.instance_variables
=&gt; [:a]
```

This was happening because `get_id_entry` ignores the tag bits when
looking up the symbol. So `rb_id2str(symid)` would return a value and
then we'd continue on with the nonsense `symid`.

This commit prevents the situation by checking that the `symid` actually
matches what we get back from `get_id_entry`. Now we get a `RangeError`
for the nonsense id:

```
&gt; ObjectSpace._id2ref(:a.object_id)
=&gt; :a
&gt; ObjectSpace._id2ref(:a.object_id + 40)
(irb):1:in `_id2ref': 0x000000000013f408 is not symbol id value (RangeError)
```

Co-authored-by: John Hawthorn &lt;jhawthorn@github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prior to this commit it was possible to call `ObjectSpace._id2ref` with
an offset static symbol object_id and get back a new, incorrectly tagged
symbol:

```
&gt; sensible_sym = ObjectSpace._id2ref(:a.object_id)
=&gt; :a
&gt; nonsense_sym = ObjectSpace._id2ref(:a.object_id + 40)
=&gt; :a
&gt; sensible_sym == nonsense_sym
=&gt; false
```

`nonsense_sym` ends up tagged with `RUBY_ID_INSTANCE` instead of
`RB_ID_LOCAL`. That means we can do silly things like:

```
&gt; foo = Object.new
&gt; foo.instance_variable_set(:a, 123)
(irb):2:in `instance_variable_set': `a' is not allowed as an instance variable name (NameError)
&gt; foo.instance_variable_set(ObjectSpace._id2ref(:a.object_id + 40), 123)
=&gt; 123
&gt; foo.instance_variables
=&gt; [:a]
```

This was happening because `get_id_entry` ignores the tag bits when
looking up the symbol. So `rb_id2str(symid)` would return a value and
then we'd continue on with the nonsense `symid`.

This commit prevents the situation by checking that the `symid` actually
matches what we get back from `get_id_entry`. Now we get a `RangeError`
for the nonsense id:

```
&gt; ObjectSpace._id2ref(:a.object_id)
=&gt; :a
&gt; ObjectSpace._id2ref(:a.object_id + 40)
(irb):1:in `_id2ref': 0x000000000013f408 is not symbol id value (RangeError)
```

Co-authored-by: John Hawthorn &lt;jhawthorn@github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix typos</title>
<updated>2021-11-02T10:17:37+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-11-02T09:29:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a2024081805af4e729bea029abb7bbe7c383dce2'/>
<id>a2024081805af4e729bea029abb7bbe7c383dce2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reenable GC at the end of test</title>
<updated>2021-08-04T20:11:08+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter.zhu@shopify.com</email>
</author>
<published>2021-08-04T19:33:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1fd0a2e4a62b70287dfce5bb1a66656b647d3899'/>
<id>1fd0a2e4a62b70287dfce5bb1a66656b647d3899</id>
<content type='text'>
The test disables GC but never reenables it. Before this patch, running
all tests would have a peak RSS in the main process of &gt;4GB. After this
patch, peak RSS in the main process is &lt;500MB.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test disables GC but never reenables it. Before this patch, running
all tests would have a peak RSS in the main process of &gt;4GB. After this
patch, peak RSS in the main process is &lt;500MB.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not check pending interrupts when running finalizers</title>
<updated>2021-07-29T16:44:11+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2021-04-07T18:32:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=87b327efe6c1f456c43b3f105c7a92a5a7effe93'/>
<id>87b327efe6c1f456c43b3f105c7a92a5a7effe93</id>
<content type='text'>
This fixes cases where exceptions raised using Thread#raise are
swallowed by finalizers and not delivered to the running thread.

This could cause issues with finalizers that rely on pending interrupts,
but that case is expected to be rarer.

Fixes [Bug #13876]
Fixes [Bug #15507]

Co-authored-by: Koichi Sasada &lt;ko1@atdot.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes cases where exceptions raised using Thread#raise are
swallowed by finalizers and not delivered to the running thread.

This could cause issues with finalizers that rely on pending interrupts,
but that case is expected to be rarer.

Fixes [Bug #13876]
Fixes [Bug #15507]

Co-authored-by: Koichi Sasada &lt;ko1@atdot.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Show exception in finalizer [Feature #17798]</title>
<updated>2021-07-23T03:01:15+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-07-22T15:32:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fc4dd45d0142221880d1b2c9b54dee0597be2b78'/>
<id>fc4dd45d0142221880d1b2c9b54dee0597be2b78</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Change heap walking to be safe for object allocation</title>
<updated>2021-03-24T18:31:10+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2021-03-12T19:36:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b25361f7319cac953145d9d15e2e673e560ec3d9'/>
<id>b25361f7319cac953145d9d15e2e673e560ec3d9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Check argument to ObjectSpace._id2ref</title>
<updated>2020-06-16T09:25:35+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2020-06-15T16:03:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=26c179d7e7e7ae0eb21050659c3e8778358230ab'/>
<id>26c179d7e7e7ae0eb21050659c3e8778358230ab</id>
<content type='text'>
Ensure that the argument is an Integer or implicitly convert to,
before dereferencing as a Bignum.  Addressed a regression in
b99833baec2.

Reported by u75615 at https://hackerone.com/reports/898614
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ensure that the argument is an Integer or implicitly convert to,
before dereferencing as a Bignum.  Addressed a regression in
b99833baec2.

Reported by u75615 at https://hackerone.com/reports/898614
</pre>
</div>
</content>
</entry>
<entry>
<title>ObjectSpace._id2ref should check liveness.</title>
<updated>2019-12-23T06:04:56+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2019-12-23T06:02:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a96f8cecc2488126d7298ea304da8bad3dde1792'/>
<id>a96f8cecc2488126d7298ea304da8bad3dde1792</id>
<content type='text'>
objspace-&gt;id_to_obj_tbl can contain died objects because of lazy
sweep, so that it should check liveness.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
objspace-&gt;id_to_obj_tbl can contain died objects because of lazy
sweep, so that it should check liveness.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert self-referencing finalizer warning [Feature #15974]</title>
<updated>2019-07-03T19:01:06+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-07-03T05:44:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=23c92b6f820f670994026423d4c7b5abcf51eafa'/>
<id>23c92b6f820f670994026423d4c7b5abcf51eafa</id>
<content type='text'>
It has caused CI failures.

* d0cd0866d82a58933e5dccd073c753c0c2ad4eb5

  Disable GC during rb_objspace_reachable_object_p

* 89cef1c56b3a0f9c5e6ccc22a5044477a4fd16c1

  Version guard for [Feature #15974]

* 796eeb6339952d92ae1b353d450c7883e589852d.

  Fix up [Feature #15974]

* 928260c2a613bbdd4402c300e0bf86ae7562e52a.

  Warn in verbose mode on defining a finalizer that captures the object
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It has caused CI failures.

* d0cd0866d82a58933e5dccd073c753c0c2ad4eb5

  Disable GC during rb_objspace_reachable_object_p

* 89cef1c56b3a0f9c5e6ccc22a5044477a4fd16c1

  Version guard for [Feature #15974]

* 796eeb6339952d92ae1b353d450c7883e589852d.

  Fix up [Feature #15974]

* 928260c2a613bbdd4402c300e0bf86ae7562e52a.

  Warn in verbose mode on defining a finalizer that captures the object
</pre>
</div>
</content>
</entry>
</feed>
