From af4864f83e4d2c06e4adfc7a1ac4b921c35e44c6 Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Thu, 28 Jun 2007 23:35:03 +0000 Subject: [PATCH] Proof of concept code I developed that we briefly deployed, but has not been used in at least two years. There are probably other (better) solutions out there for the same support. --- arch/i386/kernel/dstack.S | 63 -------------------------------- arch/i386/kernel/dstackdump.c | 41 --------------------- arch/i386/kernel/stackoverflow.c | 40 -------------------- 3 files changed, 144 deletions(-) delete mode 100644 arch/i386/kernel/dstack.S delete mode 100644 arch/i386/kernel/dstackdump.c delete mode 100644 arch/i386/kernel/stackoverflow.c diff --git a/arch/i386/kernel/dstack.S b/arch/i386/kernel/dstack.S deleted file mode 100644 index cef679947..000000000 --- a/arch/i386/kernel/dstack.S +++ /dev/null @@ -1,63 +0,0 @@ -/* - * linux/arch/i386/dstack.S - * - * Copyright (C) 2005 Marc E. Fiuczynski - */ - -/* - * dstack.s contains the system specific support for stack overflows - * and discontiguous stack support. - */ - -#include -#include -#include -#include -#include -#include -#include - -.data -.globl stack_overflowed -stack_overflowed: - .long 0 -.text - -ENTRY(mcount) -#warning stack check enabled - push %eax - movl $(THREAD_SIZE - 1),%eax - andl %esp,%eax - cmpl $STACK_WARN,%eax - jle 1f -2: - popl %eax - ret -1: - /* prevent infinite recursion from call to mcount from the - * stack_overflow function. Need to revisit this code for - * SMP based systems. - */ - lock; btsl $0,stack_overflowed - jc 2b - - /* prepare to jmp to stack_overflow directly, as if it were - * called directly by the caller of mcount. - */ - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - - call stack_overflow - /* Note that stack_overflow() will clear the stack_overflowed - * variable. - */ - - popl %edi - popl %esi - popl %ebx - popl %ebp - - popl %eax - ret diff --git a/arch/i386/kernel/dstackdump.c b/arch/i386/kernel/dstackdump.c deleted file mode 100644 index 9aad728e7..000000000 --- a/arch/i386/kernel/dstackdump.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * linux/arch/i386/kernel/stackoverflow.c - * - * Copyright (C) 2005 Marc E. Fiuczynski - * - */ - -/* - * This file handles the architecture-dependent parts of stack overflow handling... - */ - -#include -#include -#include -#include - -void dstackdump(void) -{ - unsigned long esp = current_stack_pointer(); - int panicing = ((esp&(THREAD_SIZE-1)) <= STACK_PANIC); - - oops_in_progress = 1; - printk( "esp: 0x%lx masked: 0x%lx STACK_PANIC:0x%lx %d %d\n", - esp, (esp&(THREAD_SIZE-1)), STACK_PANIC, - (((esp&(THREAD_SIZE-1)) <= STACK_PANIC)), panicing); - - show_trace(current,(void*)esp); - - if (panicing) - panic("stack overflow\n"); - - oops_in_progress = 0; - - /* Just let it happen once per task, as otherwise it goes nuts - * in printing stack traces. This means that I need to dump - * the stack_overflowed boolean into the task or thread_info - * structure. For now just turn it off all together. - */ - - /* stack_overflowed = 0; */ -} diff --git a/arch/i386/kernel/stackoverflow.c b/arch/i386/kernel/stackoverflow.c deleted file mode 100644 index f9b9f6f90..000000000 --- a/arch/i386/kernel/stackoverflow.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * linux/arch/i386/kernel/stackoverflow.c - * - * Copyright (C) 2005 Marc E. Fiuczynski - * - */ - -/* - * This file handles the architecture-dependent parts of stack overflow handling... - */ - -#include -#include -#include -#include - -void stack_overflow(void) -{ - unsigned long esp = current_stack_pointer(); - int panicing = ((esp&(THREAD_SIZE-1)) <= STACK_PANIC); - - oops_in_progress = 1; - printk( "esp: 0x%lx masked: 0x%lx STACK_PANIC:0x%lx %d %d\n", - esp, (esp&(THREAD_SIZE-1)), STACK_PANIC, - (((esp&(THREAD_SIZE-1)) <= STACK_PANIC)), panicing); - show_trace(current,(void*)esp); - - if (panicing) - panic("stack overflow\n"); - - oops_in_progress = 0; - - /* Just let it happen once per task, as otherwise it goes nuts - * in printing stack traces. This means that I need to dump - * the stack_overflowed boolean into the task or thread_info - * structure. For now just turn it off all together. - */ - - /* stack_overflowed = 0; */ -} -- 2.43.0