From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 28 17:36:11 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8014B20 for ; Thu, 28 Mar 2013 17:36:11 +0000 (UTC) (envelope-from will@firepipe.net) Received: from mail-ie0-x232.google.com (mail-ie0-x232.google.com [IPv6:2607:f8b0:4001:c03::232]) by mx1.freebsd.org (Postfix) with ESMTP id 78996859 for ; Thu, 28 Mar 2013 17:36:11 +0000 (UTC) Received: by mail-ie0-f178.google.com with SMTP id bn7so9352089ieb.23 for ; Thu, 28 Mar 2013 10:36:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=THTPRorVbnBlaHZY5rPoW0pwWEXkB4NETOXYxEfGBtM=; b=hj0rR2Vyu7weKp/ltuYA25ybAXX/wzjvQbBZz2s+J1ToZQLRoYOJaY5gChk97Pmsgf 20ok5aKS3pU62hg1NW9y2heRpOA3qjct/VuQmKgmk6petNQOd8ws2HyXdAGZfqSfG1h/ 2mDl/lRQ8QDByNR8LNbBW5O00r3aDL8bj0bGmFdzFyNH9X4EzAE0ACfdK5Bvvfez2MoV 20IhtvlTV3aEG1SDQWldZlgDZ3l9EcuV+m1u4cVPLHmhEAnIISLAigi+AMrKU5vb1cSh T2r/sKwyqzcS5ZVpipG5rJQdcB/IZzFDOK73bX7LSKf30ElPXraDz2KiqJPsjjzK6oUf 97rA== MIME-Version: 1.0 X-Received: by 10.50.30.69 with SMTP id q5mr8221226igh.1.1364492171171; Thu, 28 Mar 2013 10:36:11 -0700 (PDT) Received: by 10.231.103.70 with HTTP; Thu, 28 Mar 2013 10:36:10 -0700 (PDT) Date: Thu, 28 Mar 2013 11:36:10 -0600 Message-ID: Subject: CFR: Fix a panic in userspace dtrace From: Will Andrews To: hackers@freebsd.org X-Gm-Message-State: ALoCoQm7namMvYsTCNDu0253Os4l3V5PTvitGV5PLRN1iSCXq5dJ2qyZq2d2NjefmFMsqr9AMbF0 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: George Neville-Neil , "Justin T. Gibbs" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Mar 2013 17:36:11 -0000 Diff: http://people.freebsd.org/~will/patches/fix-fasttrap-panic.diff Commit log: Fix a panic in userspace dtrace. The bug here is that the proc lock is already held in the case of fasttrap_fork(), which then calls proc_ops(), which tries to hold it again. Upon inspection, every other consumer of proc_ops() has already placed a hold and then dropped the proc lock. Change fasttrap_fork() to match these semantics, which also happen to mirror Solaris. Change proc_ops() to assert that the proc object is held and unlocked, rather than executing a hold/rele cycle itself. Note: fasttrap_fork() is only ever called if an userspace program being dtrace'd happens to fork(). So this bug doesn't apply if you are dtrace'ing a userspace process that doesn't fork. Also, at least for ztest, userspace dtrace is still unusable because when the child process exits, both dtrace and ztest appear to spin forever. The dtrace process doesn't appear to do anything; the ztest process can't be attached via gdb since it's already being ptrace()'d by dtrace. This will require more investigation to fix. The commit log is a bit dated; I believe that more recent changes by gibbs@fixed the latter issues. Thanks, --Will.