From owner-cvs-all@FreeBSD.ORG Thu Jan 31 00:58:49 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C05616A420; Thu, 31 Jan 2008 00:58:49 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id F132813C461; Thu, 31 Jan 2008 00:58:48 +0000 (UTC) (envelope-from sam@errno.com) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id m0V0wmFX083922 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Jan 2008 16:58:48 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <47A11D48.9040909@errno.com> Date: Wed, 30 Jan 2008 16:58:48 -0800 From: Sam Leffler User-Agent: Thunderbird 2.0.0.9 (X11/20071125) MIME-Version: 1.0 To: Alexander Motin References: <200801302124.m0ULOANe012024@repoman.freebsd.org> <47A0EDC4.3040301@errno.com> <47A0F6CE.3020407@FreeBSD.org> In-Reply-To: <47A0F6CE.3020407@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys proc.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 00:58:49 -0000 Alexander Motin wrote: > Sam Leffler wrote: >> Alexander Motin wrote: >>> mav 2008-01-30 21:24:10 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> sys/sys proc.h Log: >>> Implement GET_STACK_USAGE() macro to get the current kernel thread >>> stack usage. >>> This implemntation made for growing down stack organization like >>> i386/amd64 >>> platforms have, but prefers different machine dependent version if >>> it is present. >> >> I think it is a mistake to fallback to a MD implementation; your MI >> implementation is broken on architectures that do not use the model >> you used so you any user of this will silently fail on such >> architectures. I suggest you need to fix this before you use this >> macro in any MI code. > > This implementation covers the most of popular architectures. The only > architecture with different stack organization recalled in maillist > was ia64 which has two stacks with local variables part is still > growing down. As I have no work experience with architectures other > then i386/amd64 I will gladly accept any help with implementing this. > > This time I am going to use this as a hint for stack protection engine > in netgraph subsystem. In case of incorrect implementation there could > be only two consequences: or nothing will change from present state > for stack growing down, but differently (ia64). or protection become > paranoid but slow for stack growing up. > Your change guarantees code will silently break at some point in time (almost certainly long after anyone remembers this email exchange). Just because you don't have a system where this fails doesn't justify adding a hack like this. I repeat, please fix it or remove it before anyone uses it. My suggestion is you make this MD and on architectures where you haven't tested it you add a #error. Sam