From aa0c4071694a19b0f7de5fcaca8b1f9918e06fc8 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 27 Feb 2011 05:36:54 +0100 Subject: Detect interrupt overflow * i386/i386/locore.S (int_from_instack): Check %esp against _intstack, issue ud2 on stack overflow. --- i386/i386/locore.S | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'i386') diff --git a/i386/i386/locore.S b/i386/i386/locore.S index c1e6448..d2c600a 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -704,6 +704,8 @@ LEXT(return_to_iret) /* ( label for kdb_kintr and hardclock) */ iret /* return to caller */ int_from_intstack: + cmpl $EXT(_intstack),%esp /* seemingly looping? */ + jb stack_overflowed /* if not: */ call EXT(interrupt) /* call interrupt routine */ _return_to_iret_i: /* ( label for kdb_kintr) */ pop %edx /* must have been on kernel segs */ @@ -711,6 +713,9 @@ _return_to_iret_i: /* ( label for kdb_kintr) */ pop %eax /* no ASTs */ iret +stack_overflowed: + ud2 + /* * Take an AST from an interrupt. * On PCB stack. -- cgit v1.2.3