summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-02-02 12:00:21 -0500
committerPeter Zhu <[email protected]>2024-02-05 11:11:07 -0500
commit5e0c17145131e073814c7e5b15227d0b4e73cabe (patch)
tree9d076dd1c6de347808295e70b75e4d6379e626d5 /io.c
parent02c88477ceb8d679a815721d16ce248da845cff6 (diff)
Make io_fwrite safe for compaction
[Bug #20169] Embedded strings are not safe for system calls without the GVL because compaction can cause pages to be locked causing the operation to fail with EFAULT. This commit changes io_fwrite to use rb_str_tmp_frozen_no_embed_acquire, which guarantees that the return string is not embedded.
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 7d8b9bf410..eb2698d047 100644
--- a/io.c
+++ b/io.c
@@ -1975,7 +1975,7 @@ io_fwrite(VALUE str, rb_io_t *fptr, int nosync)
if (converted)
OBJ_FREEZE(str);
- tmp = rb_str_tmp_frozen_acquire(str);
+ tmp = rb_str_tmp_frozen_no_embed_acquire(str);
RSTRING_GETMEM(tmp, ptr, len);
n = io_binwrite(tmp, ptr, len, fptr, nosync);
rb_str_tmp_frozen_release(str, tmp);