aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/byterun/coq_memory.c
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2016-10-19 14:48:14 +0200
committerGravatar Maxime Dénès <mail@maximedenes.fr>2016-10-24 18:04:26 +0200
commit897ce077f11940adce406a20ad7d5c128e90cc28 (patch)
treedb359323a84ed17d180e01ffb6af67885a3ecbfc /kernel/byterun/coq_memory.c
parent1d769e02b3baba54246c942fe116abaf850892db (diff)
Fix #5127 Memory corruption with the VM
The bytecode interpreter ensures that the stack space available at some points is above a static threshold. However, arbitrary large stack space can be needed between two check points, leading to segmentation faults in some cases. We track the use of stack space at compilation time and add an instruction to ensure greater stack capacity when required. This is inspired from OCaml's PR#339 and PR#7168. Patch written with Benjamin Grégoire.
Diffstat (limited to 'kernel/byterun/coq_memory.c')
-rw-r--r--kernel/byterun/coq_memory.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/byterun/coq_memory.c b/kernel/byterun/coq_memory.c
index c9bcdc32f..45cfae509 100644
--- a/kernel/byterun/coq_memory.c
+++ b/kernel/byterun/coq_memory.c
@@ -130,6 +130,7 @@ value init_coq_vm(value unit) /* ML */
return Val_unit;;
}
+/* [required_space] is a size in words */
void realloc_coq_stack(asize_t required_space)
{
asize_t size;