From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 13:38:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38CB8106566C for ; Wed, 11 Mar 2009 13:38:42 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id BDED28FC08 for ; Wed, 11 Mar 2009 13:38:41 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by fxm2 with SMTP id 2so5681fxm.43 for ; Wed, 11 Mar 2009 06:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=DXKWCBW+vCM4/JPU0iSjTnjBshObrugDwuP/wb9mZ6Y=; b=sEQ1+bcssnSicZMpTQiLeWfkMtovzbPqdeG70KXITS7kXCxfuC2spyeDGR9wEL3c7Q DtWcbmtrogZYU83xU5YR0A7eSdlJxFNx+bDUEIZNBYd8LH0pJMzGzsIpgFSbaWGH+Uf5 QXzxkBwrWFmi0qO/V0KZJfDpurNddu3PD89TQ= 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 :content-type:content-transfer-encoding; b=gN+rflTt/5gyx31us+oO9KYw7pwTWVOtFW1Sql22rMJ4HCNbZLRahe6zN3WkG19L7L 5tic3AaDxNB/pYDFIa17ET/KFxuBv1P89I91ZJ0uL2eTScPXXG0RFZmoV6vFhHeM4m+A wzd+2ZpP3++dxKREzF5lh2T7EIxUTiB6t/Veg= MIME-Version: 1.0 Received: by 10.86.74.4 with SMTP id w4mr5995895fga.21.1236778719720; Wed, 11 Mar 2009 06:38:39 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 Mar 2009 16:38:39 +0300 Message-ID: From: pluknet To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Non-existing p_vmspace. When is it possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2009 13:38:42 -0000 Hi. I perform in FOREACH_PROC_IN_SYSTEM(), where I conditionally look at p_vmspace internals. I'd like to know the safe way to reference p_vmspace fields without potential null-dereference. I see an example in vm_pageout_oom(), where making access to p->p_vmspace fields is done without additional checks. Nevertheless I want to further catch on how it works. Currently I additionally explicitly check on P_SYSTEM and PRS_NEW, then p->p_vmspace against NULL. So I'd wish to understand if a time-window between 1) placing a new process to proclist =A0and 2) attaching vmspace to this process is possible at all, and then in what cases. I see in fork1() that a new process' (named p2 here) state is set to PRS_NEW just before LIST_INSERT_HEAD(&allproc, p2, p_list) and then (after vmspace is already attached in vm_forkproc()) is set to PRS_NORMAL. So an additional check on p_vmspace !=3D NULL is not need. Am I right? Thanks. --=20 wbr, pluknet