Skip to content

Add missing writebarrier to rb_func_proc_dup #14199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2025

Conversation

jhawthorn
Copy link
Member

@jhawthorn jhawthorn commented Aug 12, 2025

Because TypedData_Make_Struct both allocates an object and after xmallocs memory, all added references must be writebarrier protected.

Found by wbcheck when running test/ruby/test_proc.rb

Parent object: 0x7c3ff7465410 (wb_protected: true)
    rb_obj_info_dump: 0x00007c3ff7465410 proc/Proc proc
  Reference counts - snapshot: 1, writebarrier: 0, current: 4, missed: 3
  Missing reference to: 0x7c3ff7464d50
    rb_obj_info_dump: 0x00007c3ff7464d50 proc/Proc proc
  Missing reference to: 0x7c3ff7465090
    rb_obj_info_dump: 0x00007c3ff7465090 T_IMEMO/<ifunc>
  Missing reference to: 0x7c3ff74651d0
    rb_obj_info_dump: 0x00007c3ff74651d0 T_IMEMO/<env>

Because TypedData_Make_Struct both allocates an object and after
xmallocs memory, all added references must always be writebarrier
protected.

This comment has been minimized.

@jhawthorn jhawthorn merged commit 9fedae9 into ruby:master Aug 19, 2025
87 of 89 checks passed
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.

1 participant