[lkml]   [2003]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH][2.6] WARN_ON_STACK_VAR aka fighting variable lifetime bugs
>>>>> On Sat, 9 Aug 2003 15:29:41 -0400 (EDT), Zwane Mwaikambo <> said:

Zwane> --- linux-2.6.0-test2-irq/include/asm-ia64/bug.h 30 Jul 2003 00:06:30 -0000
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>).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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