Skip to content

Commit

Permalink
Remove ibf_dumper's WB_PROTECTED status
Browse files Browse the repository at this point in the history
It doesn't have the right write barriers in place. For example, there is

    rb_mark_set(dump->global_buffer.obj_table);

in the mark function, but there is no corresponding write barrier when
adding to the table in the
`ibf_dump_object() -> ibf_table_find_or_insert() -> st_insert()` code path.

To insert write barrier correctly, we need to store the T_STRUCT VALUE
inside `struct ibf_dump`. Instead of doing that, let's just demote it
to WB unproected for correctness. These dumper object are ephemeral so
there is not a huge benefit for having them WB protected.

Users of the bootsnap gem ran into crashes due to this issue:
Shopify/bootsnap#436

Fixes [Bug #19419]
  • Loading branch information
XrXr committed Feb 13, 2023
1 parent 7ddcee5 commit 86de48e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compile.c
Expand Up @@ -13056,7 +13056,7 @@ ibf_dump_memsize(const void *ptr)
static const rb_data_type_t ibf_dump_type = {
"ibf_dump",
{ibf_dump_mark, ibf_dump_free, ibf_dump_memsize,},
0, 0, RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
};

static void
Expand Down

0 comments on commit 86de48e

Please sign in to comment.