summaryrefslogtreecommitdiff
path: root/include/ruby/internal/stdalign.h
diff options
context:
space:
mode:
authorJoshua Young <djry1999@gmail.com>2025-10-25 10:10:06 +0530
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2025-10-27 07:59:43 +0900
commit52ea222027c7315a5d66f0d7b4ab73c1cc0c7344 (patch)
treeb44a0371538f1f84ab9e891a4a2325d90326dbd2 /include/ruby/internal/stdalign.h
parentb66fbd59ae5eb4ef994e0a1c007caaf8fbd3c897 (diff)
Fix segfault when moving nested objects between ractors during GC
Fixes a segmentation fault when moving nested objects between ractors with GC stress enabled and YJIT. The issue is a timing problem: `move_enter` allocates new object shells but leaves their contents uninitialized until `move_leave` copies the actual data. If GC runs between these steps (which GC stress makes likely), it tries to follow what appear to be object pointers but are actually uninitialized memory, encountering null or invalid addresses. The fix zero-initializes the object contents immediately after allocation in `move_enter`, ensuring the GC finds safe null pointers instead of garbage data. The crash reproduced most consistently with nested hashes and YJIT, likely because nested structures create multiple uninitialized objects simultaneously while YJIT's memory usage increases the probability of GC triggering during moves.
Diffstat (limited to 'include/ruby/internal/stdalign.h')
0 files changed, 0 insertions, 0 deletions