summaryrefslogtreecommitdiff
path: root/byterun/caml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-09-22 15:19:24 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2017-09-22 15:19:24 +0200
commitc067b7932b051750b033732708b16a33b1e3cb4a (patch)
treef858596c83304850b5a1e2a225e51af9403fcdd2 /byterun/caml
parent43ed00706bdc80fe311d6b8102696dacaa4b54d1 (diff)
downloadocaml-MPR7609.tar.gz
MPR#7609: use-after-free with ocamldebug and Pervasives.flush_all (alternative solution)MPR7609
Rather than play with refcounts as in commits 796c796 and 43ed007, this commit adds a flag CHANNEL_FLAG_MANAGED_BY_GC that governs whether the struct channel can be destroyed by GC finalization. Internal channels opened by the runtime system for its own purposes do not have this flag and will never be finalized, even if they end up in the Caml heap as a consequence of Pervasives.flush_all.
Diffstat (limited to 'byterun/caml')
-rw-r--r--byterun/caml/io.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/byterun/caml/io.h b/byterun/caml/io.h
index f388bd9fb4..87de679e53 100644
--- a/byterun/caml/io.h
+++ b/byterun/caml/io.h
@@ -55,8 +55,9 @@ struct channel {
enum {
CHANNEL_FLAG_FROM_SOCKET = 1, /* For Windows */
#if defined(NATIVE_CODE) && defined(WITH_SPACETIME)
- CHANNEL_FLAG_BLOCKING_WRITE = 2,
+ CHANNEL_FLAG_BLOCKING_WRITE = 2, /* Don't release master lock when writing */
#endif
+ CHANNEL_FLAG_MANAGED_BY_GC = 4, /* Free and close using GC finalization */
};
/* For an output channel: