From owner-freebsd-hackers@freebsd.org Wed Apr 28 13:52:55 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D5A25F4F57 for ; Wed, 28 Apr 2021 13:52:55 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FVg7V3pjHz4hyt for ; Wed, 28 Apr 2021 13:52:54 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x831.google.com with SMTP id f12so46691741qtf.2 for ; Wed, 28 Apr 2021 06:52:54 -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:content-transfer-encoding:in-reply-to; bh=TXEA6ibRkxYWqM2WGm9MprgQdHj2m0kPDleSt1VbTZs=; b=NCq9HwipAsctYp2jppNJ+Eft7Y/2VWX5xEgv8hOJrGHPLg/IeXEiNGUPh3gThtomjS qstjf8GnWIvuBGTfAD4m6fyxlH4loHalgCK5wtMlK1ldFGdTHi/TnsTCybVuXR+oZcm4 h1mkbTdPRfXiFiRB6wMWrM8rVFJEUHCsAIsjtcLX8WAkM/u5/gwsEp/KFbgt3mgotN1Y WvbP+x7UEXKubH/9AdUvdUTvGoIKUyKzofi33xFF+3bqMCbMb082spmZE3jNoOYVWMFi bl4eSqIZXEITmt3vkpXGjb5UYPPRWL9GTtaOgB/Pc2hLM2U0nMowCN3Jb7WdkOqvVlmC 7dPA== 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 :content-transfer-encoding:in-reply-to; bh=TXEA6ibRkxYWqM2WGm9MprgQdHj2m0kPDleSt1VbTZs=; b=fJTizSok3g62boq+y2wxyQZuVQqki0KedxAeMTyRHC1U99zuSQzjFqft11LJFJx8y+ k/kI3LRedVNCJ9CHYzDlsak7hEobEboQX7pd5NvETBIS2Nb8g7lGEHfmfKBirRLfRvI4 DQbOIsGbZWt1go+moaRNvXBMhyV7UbbGwI2olI7hTsBD0ywIrueWVKRKAN40LFmq6saN ocD+Y/V01IFl2NlwluBg6NmxfCFHMJ5YN+TQ9FelIOLYJ93U7s5PC7M83uY84VQPaZZ/ I+WqBjOyKageIAUx575I+i+U9kjO5Fg/nd2TWT4AjlRSyb8arzj/gsndrmN0LTyiXWHB MRFw== X-Gm-Message-State: AOAM5328HEk5ugaOz7YcFNCTF9SPVPdWoORYefRrYSxSwfmKXH4LDDII 6f2L6IY3NT2QXUERUTiTxZg= X-Google-Smtp-Source: ABdhPJwSIkSa1KENq3LXy0nzZkvqjS3/yb0keCZxuMwqfVqJOXhbUyiOfS+ZkyMZDZygXoieEIicSg== X-Received: by 2002:ac8:7fc5:: with SMTP id b5mr26811070qtk.41.1619617973387; Wed, 28 Apr 2021 06:52:53 -0700 (PDT) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id c2sm5223086qkk.2.2021.04.28.06.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 06:52:52 -0700 (PDT) Sender: Mark Johnston Date: Wed, 28 Apr 2021 09:52:55 -0400 From: Mark Johnston To: =?utf-8?B?SW9udcib?= Mihalache Cc: freebsd-hackers@freebsd.org Subject: Re: cap_sysctlbyname for hw.vmm.destroy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4FVg7V3pjHz4hyt X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=NCq9Hwip; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::831 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::831:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::831:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::831:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2021 13:52:55 -0000 On Wed, Apr 28, 2021 at 02:30:26PM +0300, Ionuț Mihalache wrote: > I tried to test the example from the documentation between here [1] and > here [2]. The code stops here [3]. I think you're referencing an old version of the cap_sysctl man page? See the example from the copy in your repo: https://github.com/FreeBSD-UPB/freebsd-src/blob/3a08ffe4839de9b8396b1760f1dc42b066428807/lib/libcasper/services/cap_sysctl/cap_sysctl.3#L122 In particular, when setting limits consumers should not be building nvlists directly. > [1] - > https://github.com/FreeBSD-UPB/freebsd-src/blob/3a08ffe4839de9b8396b1760f1dc42b066428807/usr.sbin/bhyve/bhyverun.c#L1538 > [2] - > https://github.com/FreeBSD-UPB/freebsd-src/blob/3a08ffe4839de9b8396b1760f1dc42b066428807/usr.sbin/bhyve/bhyverun.c#L1585 > [3] - > https://github.com/FreeBSD-UPB/freebsd-src/blob/3a08ffe4839de9b8396b1760f1dc42b066428807/usr.sbin/bhyve/bhyverun.c#L1581 > > În lun., 26 apr. 2021 la 20:40, Mark Johnston a scris: > > > On Mon, Apr 26, 2021 at 05:16:14PM +0300, Ionuț Mihalache wrote: > > > Hello, > > > > > > I am working on adding capsicum support for the bhyve snapshot feature. > > At > > > the end of the suspend process, the guest should be destroyed and the > > code > > > handles this part with a sysctlbyname call which is not working in > > > capability mode. I don't know what is the problem but even when using > > > cap_sysctlbyname I still get the same error code (EPERM). I tried the > > > example from the documentation aswell [1] and still the same error code. > > > What could be the problem? I have a FreeBSD13 host and a FreeBSD13 guest. > > > > I'm not sure why it would happen unless the casper process is somehow > > running as a non-root user. Can you share the code you're testing > > somewhere? > >