diff options
author | Peter Zhu <peter@peterzhu.ca> | 2024-02-02 12:00:21 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2024-02-05 11:11:07 -0500 |
commit | 5e0c17145131e073814c7e5b15227d0b4e73cabe (patch) | |
tree | 9d076dd1c6de347808295e70b75e4d6379e626d5 /internal | |
parent | 02c88477ceb8d679a815721d16ce248da845cff6 (diff) | |
download | ruby-5e0c17145131e073814c7e5b15227d0b4e73cabe.tar.gz |
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 'internal')
-rw-r--r-- | internal/string.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/string.h b/internal/string.h index 8c481f979e..ba2af25877 100644 --- a/internal/string.h +++ b/internal/string.h @@ -57,6 +57,7 @@ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2); RUBY_SYMBOL_EXPORT_BEGIN /* string.c (export) */ VALUE rb_str_tmp_frozen_acquire(VALUE str); +VALUE rb_str_tmp_frozen_no_embed_acquire(VALUE str); void rb_str_tmp_frozen_release(VALUE str, VALUE tmp); VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc); VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE); |