From owner-freebsd-virtualization@freebsd.org Thu Aug 9 14:53:06 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 949D31069703 for ; Thu, 9 Aug 2018 14:53:06 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16E2779135 for ; Thu, 9 Aug 2018 14:53:06 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf1-x444.google.com with SMTP id p12-v6so2976417pfh.2 for ; Thu, 09 Aug 2018 07:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RRW92JbHaDNaIHOAoA0Py1tCsG7s36XtkjF4f/wFfIg=; b=XzovleSNT4cLRwNK8KLwemcrZOBYjwGCqxBW8JDCuLMXs4PGKHZ7IJKplLLsDDIT45 l2YbEVpwK+rBIuul/8IrP4p0XsHTGBUV0flxjpJfQHtLxsQwAARoDy2ImGEEIO94KkiO 5BR6osEEWG8bkdJzue3onC1xYX+CJXwwjb6WdLkMOz2VKXC7ACrJnqhXMk/e3goqJBv1 p6n6sXKnOP6e6ejOtWFdD2L8MmMlsl1AblV5Elf1KGhyxyY4Eub2WmKkeBA+C2FsF0xv 89MoKg5cGhmHkV6PTQwnyXMgAEMQLi+YSpP1P6oXV8GlUrwax5MnwEGbwTPsZSoU/Rqv Nygg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=RRW92JbHaDNaIHOAoA0Py1tCsG7s36XtkjF4f/wFfIg=; b=fSzFdi+IR0CFziJreYSH28/Ym8rCY4kfszpeIWRpzGNmJHkHUtzKvUVapI6cxgHBex y7XRQ9mQM60vlMnYZ6IGdsfpJYFuJL49W9s6TSIXBFoRpwjEweeAG44iO8orQMNm8EFO twPuOTRFMOieTopjgTLp4zYnSUYhlwliSzvir1HWdQAt9LtQ6kbj4tBOSIP1Pczn77zd 4i/qdlSpT6Un6jDCp2sbymxg3L/maENAfh8uibmWoR9+IYYPE7DmU9TfbFUMvxo2XKXR /kp2A/h73lW046i1eViog4PF6Ia0GRUCZWvpEacC6OqOKl5j7ZTR+8Y8Y79Nj4L9TuLQ eV4w== X-Gm-Message-State: AOUpUlHix6FS+DcZxFiYKb3gm3cEi4ylssfi0+Z7S7WMnBrlPtmL+C5c v+6Uk5v/WUzRNdRaW67ja7XlqOMa X-Google-Smtp-Source: AA+uWPxgli/nT4mX06QOh9FhKJhi+1bFsEkOQvcMh21Pk3sz78b0pjmwiZi7mE3oOusCHAqYXq/ksQ== X-Received: by 2002:a63:fd06:: with SMTP id d6-v6mr2537606pgh.348.1533826385083; Thu, 09 Aug 2018 07:53:05 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-239.dsl.bell.ca. [70.52.224.239]) by smtp.gmail.com with ESMTPSA id u42-v6sm9854961pgn.1.2018.08.09.07.53.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 07:53:04 -0700 (PDT) Sender: Mark Johnston Date: Thu, 9 Aug 2018 10:52:59 -0400 From: Mark Johnston To: "Patrick M. Hausen" Cc: freebsd-virtualization@freebsd.org Subject: Re: Why can't I dtrace processes running in a jail from the host? Message-ID: <20180809145258.GA68459@raichu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 14:53:06 -0000 On Thu, Aug 09, 2018 at 01:09:00PM +0200, Patrick M. Hausen wrote: > Hi all, > > I'm wondering why on a busy hosting server with hundreds of PHP-FPM > workers running in jails "dtrace -l" on the host does not show any > PHP specific probes. PHP *is* compiled with dtrace support for all the > jails. > > Enabling /dev/dtrace/* via devfs.rules for a specific jail and then repeating > the process *inside* the jail works as expected. > > Shouldn't jailed processes be transparently visible from the host system > but not vice versa? For userland static probes to be globally visible, the process needs to register them with the kernel when it starts. This is done automatically using a constructor which issues ioctls to /dev/dtrace/helper, hence the requirement for /dev/dtrace/* in the jail. In general it is still possible to use unregistered userland probes in this scenario: dtrace(1) can discover them when it attaches to a specified process. I'm not sure how well this will work if the process is jailed and dtrace(1) is invoked on the host, but it's worth trying. I would be rather wary of enabling access to /dev/dtrace/* in a jail. The kernel code which parses probe metadata has a large attack surface and has had security holes in the past.