1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-06 20:20:20 +02:00

Make code and data buffer readonly.

* lib/lightning.c: Make data and code buffer readonly.
This commit is contained in:
pcpa 2013-03-06 16:36:38 -03:00
parent da4c3f365a
commit f39eee6694
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2013-03-06 Paulo Andrade <pcpa@gnu.org>
* lib/lightning.c: Make data and code buffer readonly.
2013-02-20 Paulo Andrade <pcpa@gnu.org> 2013-02-20 Paulo Andrade <pcpa@gnu.org>
* doc/body.texi: Fool proof validate the examples of what * doc/body.texi: Fool proof validate the examples of what

View file

@ -1376,6 +1376,7 @@ _jit_emit(jit_state_t *_jit)
jit_node_t *node; jit_node_t *node;
jit_int32_t mult; jit_int32_t mult;
size_t length; size_t length;
int result;
if (_jit->function) if (_jit->function)
jit_epilog(); jit_epilog();
@ -1430,6 +1431,11 @@ _jit_emit(jit_state_t *_jit)
_jit->done = 1; _jit->done = 1;
jit_annotate(); jit_annotate();
result = mprotect(_jit->data.ptr, _jit->data.length, PROT_READ);
assert(result == 0);
result = mprotect(_jit->code.ptr, _jit->code.length, PROT_READ | PROT_EXEC);
assert(result == 0);
return (code); return (code);
} }