Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S272875AbTHKSqb (ORCPT ); Mon, 11 Aug 2003 14:46:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S273052AbTHKSoq (ORCPT ); Mon, 11 Aug 2003 14:44:46 -0400 Received: from palrel10.hp.com ([156.153.255.245]:21965 "EHLO palrel10.hp.com") by vger.kernel.org with ESMTP id S273028AbTHKSnQ (ORCPT ); Mon, 11 Aug 2003 14:43:16 -0400 From: David Mosberger MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16183.58300.408086.272654@napali.hpl.hp.com> Date: Mon, 11 Aug 2003 11:43:08 -0700 To: Zwane Mwaikambo Cc: Linux Kernel , William Lee Irwin III , Bartlomiej Zolnierkiewicz , Jens Axboe Subject: Re: [PATCH][2.6] WARN_ON_STACK_VAR aka fighting variable lifetime bugs In-Reply-To: References: X-Mailer: VM 7.07 under Emacs 21.2.1 Reply-To: davidm@hpl.hp.com X-URL: http://www.hpl.hp.com/personal/David_Mosberger/ Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1205 Lines: 29 >>>>> 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 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 ). Thanks, --david - 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/