Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
  • gerd's avatar
    670d643f
    Optional control stack checking. This is controlled by the · 670d643f
    gerd authored
    	feature :stack-checking because it's not implemented for other
    	systems/architectures yet.  It is currently known to work on
    	FreeBSD 4.8-RC/x86 and Debian 2.2.20/x86.
    
    	* bootfiles/18e/boot3.lisp: New boot file, well, only a
    	description of the boot procedure since no boot file is needed.
    
    	* lisp/x86-validate.h (SIGNAL_STACK_START, SIGNAL_STACK_SIZE)
    	[__FreeBSD__, __linux__]: New defines.
    	(CONTROL_STACK_SIZE) {__FreeBSD__, __linux__]:
    	Adjust for signal stack.
    
    	* lisp/validate.c (validate) [RED_ZONE_HIT]: Call
    	os_guard_control_stack.  Some cleanup.
    
    	* lisp/os.h (BOTH_ZONES, YELLOW_ZONE, RED_ZONE): New enums.
    	Add function prototypes.
    
    	* lisp/interrupt.c (interrupt_install_low_level_handler)
    	[RED_ZONE_HIT]: Deliver protection violations on a dedicated
    	signal stack.
    
    	* lisp/os-common.c (os_stack_grows_down_1, os_stack_grows_down):
    	New functions.
    	(guard_zones, control_stack_zone, os_guard_control_stack)
    	(os_control_stack_overflow) [RED_ZONE_HIT]: New functions.
    	(os_control_stack_overflow) [!RED_ZONE_HIT]: Dummy function.
    
    	* lisp/Linux-os.c (sigsegv_handler) [RED_ZONE_HIT]: Handle control
    	stack overflows.
    
    	* lisp/FreeBSD-os.c: General cleansing.
    	(sigbus_handler) [RED_ZONE_HIT]: Handle control stack overflows.
    
    	* lisp/FreeBSD-os.h (PROTECTION_VIOLATION_SIGNAL): New define.
    
    	* lisp/Linux-os.h (PROTECTION_VIOLATION_SIGNAL): New define.
    
    	* compiler/x86/system.lisp (lisp::%scrub-control-stack): Change
    	defknown from sys:scrub-control-stack.
    	(%scrub-control-stack): Rename VOP.
    
    	* code/lispinit.lisp (os-guard-control-stack) [#+stack-checking]:
    	Define alien os_guard_control_stack.
    	(%scrub-control-stack) [#+x86]: New function.
    	(scrub-control-stack) [#+x86]: Call %scrub-control-stack,
    	call os-guard-control-stack if #+stack-checking.
    
    	* code/interr.lisp (yellow-zone-hit,
    	red-zone-hit) [#+stack-checking]: New functions.
    
    	* code/error.lisp (stack-overflow) [#+stack-checking]: New
    	condition.
    
    	* compiler/generic/new-genesis.lisp (finish-symbols)
    	[#+stack-checking]: Add symbols for control stack checking.
    
    	* compiler/x86/parms.lisp (static-symbols): Likewise.
    670d643f
    History
    Optional control stack checking. This is controlled by the
    gerd authored
    	feature :stack-checking because it's not implemented for other
    	systems/architectures yet.  It is currently known to work on
    	FreeBSD 4.8-RC/x86 and Debian 2.2.20/x86.
    
    	* bootfiles/18e/boot3.lisp: New boot file, well, only a
    	description of the boot procedure since no boot file is needed.
    
    	* lisp/x86-validate.h (SIGNAL_STACK_START, SIGNAL_STACK_SIZE)
    	[__FreeBSD__, __linux__]: New defines.
    	(CONTROL_STACK_SIZE) {__FreeBSD__, __linux__]:
    	Adjust for signal stack.
    
    	* lisp/validate.c (validate) [RED_ZONE_HIT]: Call
    	os_guard_control_stack.  Some cleanup.
    
    	* lisp/os.h (BOTH_ZONES, YELLOW_ZONE, RED_ZONE): New enums.
    	Add function prototypes.
    
    	* lisp/interrupt.c (interrupt_install_low_level_handler)
    	[RED_ZONE_HIT]: Deliver protection violations on a dedicated
    	signal stack.
    
    	* lisp/os-common.c (os_stack_grows_down_1, os_stack_grows_down):
    	New functions.
    	(guard_zones, control_stack_zone, os_guard_control_stack)
    	(os_control_stack_overflow) [RED_ZONE_HIT]: New functions.
    	(os_control_stack_overflow) [!RED_ZONE_HIT]: Dummy function.
    
    	* lisp/Linux-os.c (sigsegv_handler) [RED_ZONE_HIT]: Handle control
    	stack overflows.
    
    	* lisp/FreeBSD-os.c: General cleansing.
    	(sigbus_handler) [RED_ZONE_HIT]: Handle control stack overflows.
    
    	* lisp/FreeBSD-os.h (PROTECTION_VIOLATION_SIGNAL): New define.
    
    	* lisp/Linux-os.h (PROTECTION_VIOLATION_SIGNAL): New define.
    
    	* compiler/x86/system.lisp (lisp::%scrub-control-stack): Change
    	defknown from sys:scrub-control-stack.
    	(%scrub-control-stack): Rename VOP.
    
    	* code/lispinit.lisp (os-guard-control-stack) [#+stack-checking]:
    	Define alien os_guard_control_stack.
    	(%scrub-control-stack) [#+x86]: New function.
    	(scrub-control-stack) [#+x86]: Call %scrub-control-stack,
    	call os-guard-control-stack if #+stack-checking.
    
    	* code/interr.lisp (yellow-zone-hit,
    	red-zone-hit) [#+stack-checking]: New functions.
    
    	* code/error.lisp (stack-overflow) [#+stack-checking]: New
    	condition.
    
    	* compiler/generic/new-genesis.lisp (finish-symbols)
    	[#+stack-checking]: Add symbols for control stack checking.
    
    	* compiler/x86/parms.lisp (static-symbols): Likewise.