Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756678AbZCWUmp (ORCPT ); Mon, 23 Mar 2009 16:42:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752264AbZCWUme (ORCPT ); Mon, 23 Mar 2009 16:42:34 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:37268 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752079AbZCWUmd (ORCPT ); Mon, 23 Mar 2009 16:42:33 -0400 Date: Tue, 24 Mar 2009 02:12:20 +0530 From: "K.Prasad" To: Alan Stern Cc: Ingo Molnar , Linux Kernel Mailing List , Andrew Morton , Benjamin Herrenschmidt , Frederic Weisbecker , Maneesh Soni , Roland McGrath , Steven Rostedt Subject: Re: [Patch 01/11] Introducing generic hardware breakpoint handler interfaces Message-ID: <20090323204220.GA19602@in.ibm.com> Reply-To: prasad@linux.vnet.ibm.com References: <20090323190328.GA23426@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1988 Lines: 55 On Mon, Mar 23, 2009 at 03:21:49PM -0400, Alan Stern wrote: > On Tue, 24 Mar 2009, K.Prasad wrote: > > > > > Ok. Will do something like: > > > > return (va <= (TASK_SIZE - (hw_breakpoint_length * word_size))); > > > > > > What is the purpose of word_size here? The breakpoint length should be > > > specified in bytes, not words. > > > > > > Don't forget that that in arch_check_va_in_kernelspace() you need to > > > check both for values that are too low and values that are too high > > > (they overflow and wrap around back to a user address). > > > > > > > While I understand the user-space checking using the length of the HW > > Breakpoint, I don't really see how I can check for an upper-bound for > > kernel-space virtual addresses. Most usage in the kernel only checks for > > the address >= TASK_SIZE (while they check for add + len if the length > > of the memory is known). I will be glad to have any suggestions in this > > regard. > > Isn't that exactly the check you need to implement? > > addr >= TASK_SIZE && (addr + len) >= TASK_SIZE, > > or perhaps better, > > addr >= TASK_SIZE && (addr + len) >= addr. > > In this case you _do_ know the length of the breakpoint. > > Alan Stern > Aren't we just checking if len is a positive number through the above checks? The validation checks in the patchset should take care of negative lengths. Or am I missing something? I thought you wanted the code to check for an upper sane limit for addr in kernel-space, say something like this: TASK_SIZE <= addr <= (Upper limit for Kernel Virtual Address) When I referred to 'len' in my previous mail, it meant the length of the kernel virtual memory area (which can be used to find the upper bound). Thanks, K.Prasad -- 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/