From owner-svn-src-head@FreeBSD.ORG Fri Sep 24 12:24:19 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 7119F1065670; Fri, 24 Sep 2010 12:24:19 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id E0E6F8FC0A; Fri, 24 Sep 2010 12:24:18 +0000 (UTC) Received: by qyk31 with SMTP id 31so1286454qyk.13 for ; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hXGcuuIugQOXqRWtVxSXG6RpShLYjNny0BSXaRbfBj4=; b=I1ox2JwE8Sr3mHYMFWUK6/U6eXMABCaFF9J4RncGZrWnxCgUj20hoerSCUo86GCOYp eMuhi9X00LQq/I8+hc6LRdgagaF8IKEgaPYCs0MyKYCWkKVeTZUzCJTXbQ/SxbaQQ5sx nRP094ikMRlqjvwJZwPZX6cRnIe8GAGEA3CRU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=R09/2mQe/daCuH3HMgDNeTET8LAN1EEUvSHQLvLpXSoBhvE7DUlzB/Rg15AzCAoRzL /ggT5K6nWepTcXPAyO52Gjgde1akV/iPyMuHYU67oc2my8Vro01GAsO93+6TM3cW5N2R J9t5ni+2Sd59Ls3cGLtM5P13eOjrLtKxzRk58= MIME-Version: 1.0 Received: by 10.229.246.194 with SMTP id lz2mr2477723qcb.216.1285331058297; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) Received: by 10.229.50.8 with HTTP; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) In-Reply-To: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> Date: Fri, 24 Sep 2010 16:24:18 +0400 Message-ID: From: pluknet To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav 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 12:24:19 -0000 2010/9/24 Kostik Belousov : > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: >> On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: >> > Author: des >> > Date: Thu Sep 16 07:56:34 2010 >> > New Revision: 212723 >> > URL: http://svn.freebsd.org/changeset/base/212723 >> > >> > Log: >> > =A0Implement proc/$$/environment. >> > >> [...] >> >> > =A0/* >> > =A0* Filler function for proc/pid/environ >> > =A0*/ >> > =A0static int >> > =A0linprocfs_doprocenviron(PFS_FILL_ARGS) >> > =A0{ >> > + =A0 =A0 =A0 int ret; >> > >> > - =A0 =A0 =A0 sbuf_printf(sb, "doprocenviron\n%c", '\0'); >> > - =A0 =A0 =A0 return (0); >> > + =A0 =A0 =A0 PROC_LOCK(p); >> >> With this change I observe the following sleepable after non-sleepable: >> [LOR there] >> >> >> > + >> > + =A0 =A0 =A0 if ((ret =3D p_cansee(td, p)) !=3D 0) { >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PROC_UNLOCK(p); >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret; >> > + =A0 =A0 =A0 } >> > + >> > + =A0 =A0 =A0 ret =3D linprocfs_doargv(td, p, sb, ps_string_env); >> > + =A0 =A0 =A0 PROC_UNLOCK(p); >> > + =A0 =A0 =A0 return (ret); >> > =A0} > > 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. > Thanks for quick reaction. As for the latter, something doesn't quite work here. I see EFAULT against i386 process running on amd64. --=20 wbr, pluknet