lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 21 Aug 2010 17:08:23 +0400
From:	Sergei Shtylyov <sshtylyov@...sta.com>
To:	jiang.adam@...il.com
CC:	ralf@...ux-mips.org, dmitri.vorobiev@...ial.com,
	wuzhangjin@...il.com, ddaney@...iumnetworks.com,
	peterz@...radead.org, fweisbec@...il.com, tj@...nel.org,
	tglx@...utronix.de, mingo@...e.hu, linux-mips@...ux-mips.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mips: irq: add statckoverflow detection

Hello.

jiang.adam@...il.com wrote:

> From: Adam Jiang <jiang.adam@...il.com>

> Add stackoverflow detection to mips arch

> Signed-off-by: Adam Jiang <jiang.adam@...il.com>
[...]
> diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
> index c6345f5..6334037 100644
> --- a/arch/mips/kernel/irq.c
> +++ b/arch/mips/kernel/irq.c
> @@ -151,6 +151,22 @@ void __init init_IRQ(void)
>  #endif
>  }
>  
> +static inline void check_stack_overflow(void)
> +{
> +#ifdef CONFIG_DEBUG_STACKOVERFLOW

    #ifdef within function is considered bad style. Better do it this way:

#ifdef CONFIG_DEBUG_STACKOVERFLOW
static inline void check_stack_overflow(void)
{
[...]
}
#else
static inline void check_stack_overflow(void) {}
#endif

> +	long sp;
> +
> +	asm volatile("move %0, $sp" : "=r" (sp));
> +	sp = sp & (THREAD_SIZE-1);
> +
> +	/* check for stack overflow: is there less then 2KB free? */

    Hm, 2KB seems pretty large margin...

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ