aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index e65e889898..b5f35df2bd 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -201,6 +201,27 @@ enum vm_regan_acttype {
/**********************************************************/
+/* deal with stack canary */
+/**********************************************************/
+
+#if VM_CHECK_MODE > 0
+#define DECLARE_CANARY bool leaf; VALUE *canary
+#define SETUP_CANARY() \
+ if ((leaf = INSN_ATTR(leaf))) { \
+ canary = GET_SP(); \
+ SET_SV(vm_stack_canary); \
+ }
+#define CHECK_CANARY() \
+ if (leaf && (*canary != vm_stack_canary)) { \
+ vm_canary_is_found_dead(INSN_ATTR(bin), *canary); \
+ }
+#else
+#define DECLARE_CANARY /* void */
+#define SETUP_CANARY() /* void */
+#define CHECK_CANARY() /* void */
+#endif
+
+/**********************************************************/
/* others */
/**********************************************************/