Sure. But exactly that information is not contained in the manpage (as
of Debians 3.2.3). I guess I'll have to dig deeper.
> I've attached a fairly recent version of the stack check patch. If you
> need some more examples, check out kernprof's use of it. It's acg
> functionality used mcount as well.
Oh, kernprof was too advanced already. It basically worked out of the
box for me, porting it to ppc took maybe one hour, not counting a
linker problem that was loosely related to that patch. Never bothered
to really understand what it does. :(
> diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
> --- a/arch/i386/kernel/process.c Mon Jan 27 11:40:03 2003
> +++ b/arch/i386/kernel/process.c Mon Jan 27 11:40:03 2003
> @@ -159,7 +159,22 @@
>
> __setup("idle=", idle_setup);
>
> -void show_regs(struct pt_regs * regs)
> +void stack_overflow(unsigned long esp, unsigned long eip)
> +{
> + int panicing = ((esp&(THREAD_SIZE-1)) <= STACK_PANIC);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> + if (panicing)
> + print_symbol("stack overflow from %s\n", eip);
> + else
> + print_symbol("excessive stack use from %s\n", eip);
> + printk("esp: %p\n", (void*)esp);
> + show_trace((void*)esp);
> +
> + if (panicing)
> + panic("stack overflow\n");
> +}
> +
> +asmlinkage void show_regs(struct pt_regs * regs)
> {
> unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
>
> diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
> --- a/include/asm-i386/thread_info.h Mon Jan 27 11:40:03 2003
> +++ b/include/asm-i386/thread_info.h Mon Jan 27 11:40:03 2003
> @@ -63,6 +63,8 @@
> */
> #define THREAD_ORDER 1
> #define INIT_THREAD_SIZE THREAD_SIZE
> +#define STACK_PANIC 0x200ul
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +#define STACK_WARN ((THREAD_SIZE)>>1)
>
> #ifndef __ASSEMBLY__
If I read this correctly, your patch doesn't catch everything, if
there are functions remaining that use stack frames >0x200ul. Ok,
tell me I'm wrong and should go through the assembler code first.
Jörn
-- Fantasy is more important than knowlegde. Knowlegde is limited, while fantasy embraces the whole world. -- Albert Einstein - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/