Test stack overflow in LIARC interrupt checks.
authorTaylor R Campbell <campbell@mumble.net>
Mon, 9 Nov 2009 14:44:11 +0000 (09:44 -0500)
committerTaylor R Campbell <campbell@mumble.net>
Mon, 9 Nov 2009 14:44:11 +0000 (09:44 -0500)
src/microcode/liarc.h

index e5dd5bae6e143b747e4d60b040c2348eb178464b..91f137768a180d6aa139e557166a7e4085d708ed 100644 (file)
@@ -291,19 +291,22 @@ typedef unsigned long entry_count_t;
 
 #define INTERRUPT_CHECK(code, entry_point) do                          \
 {                                                                      \
-  if (((long) Rhp) >= ((long) GET_MEMTOP))                             \
+  if ((((long) Rhp) >= ((long) GET_MEMTOP))                            \
+      || (((long) Rsp) < ((long) GET_STACK_GUARD)))                    \
     INVOKE_INTERFACE_1 (code, (&current_block[entry_point]));          \
 } while (false)
 
 #define DLINK_INTERRUPT_CHECK(code, entry_point) do                    \
 {                                                                      \
-  if (((long) Rhp) >= ((long) GET_MEMTOP))                             \
+  if ((((long) Rhp) >= ((long) GET_MEMTOP))                            \
+      || (((long) Rsp) < ((long) GET_STACK_GUARD)))                    \
     INVOKE_INTERFACE_2 (code, (&current_block[entry_point]), Rdl);     \
 } while (false)
 
 #define CLOSURE_INTERRUPT_CHECK(code) do                               \
 {                                                                      \
-  if (((long) Rhp) >= ((long) GET_MEMTOP))                             \
+  if ((((long) Rhp) >= ((long) GET_MEMTOP))                            \
+      || (((long) Rsp) < ((long) GET_STACK_GUARD)))                    \
     INVOKE_INTERFACE_0 (code);                                         \
 } while (false)