From owner-svn-src-head@FreeBSD.ORG Fri Sep 24 23:50:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4759F1065670; Fri, 24 Sep 2010 23:50:01 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0307F8FC15; Fri, 24 Sep 2010 23:50:00 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id D12C21FFC34; Fri, 24 Sep 2010 23:49:59 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id ABD198452F; Sat, 25 Sep 2010 01:49:59 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kostik Belousov References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> Date: Sat, 25 Sep 2010 01:49:59 +0200 In-Reply-To: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Fri, 24 Sep 2010 14:53:11 +0300") Message-ID: <86d3s2og60.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 23:50:01 -0000 Kostik Belousov writes: > This is easy to fix, isn't it ? But there seems to be much more nits. > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > good. > > Second, the initialization of iov_len for reading the array > of string pointers misses '* sizeof(char *)'. > > And third (probably fatal) is the lack of checks that the end of > array and each string fits into the user portion of the map. I do not > see why addr that already has u_long type is casted to u_long. Also, > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > FreeBSD ABI, they may differ from the target process limits. Blah, I clearly didn't look closely enough at the final version. The original patch used malloc() but introduced a potential race condition due to having to drop the process lock. I wrote a version that used _PHOLD() / _PRELE() to hold the process across the unlock / malloc / lock window, but the originator had trouble with it (albeit only in qemu, not on real hardware), and I wasn't 100% sure my reasoning was sound, so I accepted his suggested solution. I'll look into this tomorrow. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no