lkml.org 
[lkml]   [2003]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][2.6] WARN_ON_STACK_VAR aka fighting variable lifetime bugs
On Mon, 11 Aug 2003, David Mosberger wrote:

> >>>>> On Sat, 9 Aug 2003 15:29:41 -0400 (EDT), Zwane Mwaikambo <zwane@arm.linux.org.uk> said:
>
> Zwane> --- linux-2.6.0-test2-irq/include/asm-ia64/bug.h 30 Jul 2003 00:06:30 -0000 1.1.1.1
> Zwane> +++ linux-2.6.0-test2-irq/include/asm-ia64/bug.h 9 Aug 2003 19:14:09 -0000
> Zwane> +#define WARN_ON_STACK_VAR(ptr) do { \
> Zwane> + unsigned long __ti = (unsigned long)current_thread_info(); \
> Zwane> + WARN_ON((__ti & (unsigned long)(ptr)) == __ti); \
> Zwane> +} while (0)
>
> Note that on ia64 we don't use bit-masking to calculate the
> task-pointer. Instead, thread-info follows the task structure. This
> is done such that the task-structure, thread-info, and kernel stack
> can be mapped by a single (pinned) TLB entry.
>
> The correct check for a variable being on the stack of the current
> task would be something like this:
>
> ((unsigned long)(ptr) - (unsigned long) current) < IA64_STK_OFFSET
>
> (IA64_STK_OFFSET is declared by <asm/ptrace.h>).

Ah thanks =) i've modified my patch accordingly.

Zwane

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.049 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site