From nobody Fri Mar 17 10:29:32 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PdL3J6WpXz3yBV3; Fri, 17 Mar 2023 10:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PdL3J4KhMz3Gym; Fri, 17 Mar 2023 10:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oJzSkw+QaoseRBlUk77FifLRg/795Q1CgFh83hjox3s=; b=o6LlwN0MCqIp28nmA7WW+W0cuSJs+EpxUJ4z+28528fOMMQQVrc70HZf7UpYtKM8b7a/16 pm6uBr6TXI7w8KU8g9MCLJaeOqLQBfKmUEudNGWpRtBZifSF//p04Ahuw9qTS+WT940wda P0yapr/hVgbGkVRMM2u0POtgmYFspGCz4sODxP+YU+sDqzrMtzVFLmyzVQchY+jL0UNdN8 Kp+xD1lcgI/IB/uLeZsRTtL4/sgk5Ce1u9k80UUzdTNn9OxKCIi7HqYIfUUANd36lRFoLt TthJ8LoXC8C8A+qt2W8Ht5MpaPps1hXPqUG8rKe9n4Tp7jJ7eNV/wdtkvxBPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oJzSkw+QaoseRBlUk77FifLRg/795Q1CgFh83hjox3s=; b=BbJ1AsTIb5fIXY8s174b3eWpmErzYZ04FekAvFZ3QnXd8OP1+P8xSY4EvxixDz1stDDwUE w61kWJbBgMYCW/XJyKpr62wMF216IddlDiriFyup10VS8mcYSDgCQip5rR+WEFojtq4WmV jsbnK1ByghDe5MxkDUY4RmiODaUxKaGSDer4wsf/mNPrO/bOxoFQwTagw2jCnTerQAde6v NqhFV6pVC4cEzNCbSaNFuCLJcOdh7k8mQqh0Arj3uvk9yxNXcATwSRoGDchwJVl1rOyIIJ IrNsVPT7FjID1meGzDRNEFqgOe9W9RWj996fGTZqvXC9ykIEe4kiMDG2tVUaCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679048972; a=rsa-sha256; cv=none; b=E7OggwJsWZHcPQ51+d4TY/YtIi1upd1kot4/GjxjSazIk0jma2vLbN4iQ8D2DQeNCxoCps HNpamVyBuY3OmH9rRBgIe32HRWEf+RdcBPyjD2YMVM4WqQHOaYZT8ecxubEolxBfOC7FRb ec8NXpGUEScY98NlyCEbWY+/YtfNNgRERh61qq7gqBdl8gqWr6iZ2NTMrR8c/mHXeaU2dd UCjAJ/CRA4tN+BcdBeWiAtgibs5RrCuROwlHzAhAr8Vg2eOvOuP74Yr0VsQXFLhAY+pERt lsePqu9xqXoGInj+TrmnZtlxN84I7B4iz2pxxeYs0rN2i57Ww+vefRlh1X9J9Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PdL3J3QQlzMpZ; Fri, 17 Mar 2023 10:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32HATW5x067509; Fri, 17 Mar 2023 10:29:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HATWqe067508; Fri, 17 Mar 2023 10:29:32 GMT (envelope-from git) Date: Fri, 17 Mar 2023 10:29:32 GMT Message-Id: <202303171029.32HATWqe067508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 2193f12bf8db - stable/13 - bhyve: add cap limits for ipc socket List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2193f12bf8db21ed1c99dbe02573bb0705a1466e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=2193f12bf8db21ed1c99dbe02573bb0705a1466e commit 2193f12bf8db21ed1c99dbe02573bb0705a1466e Author: Vitaliy Gusev AuthorDate: 2023-03-06 11:36:40 +0000 Commit: Corvin Köhne CommitDate: 2023-03-17 10:26:35 +0000 bhyve: add cap limits for ipc socket Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38856 (cherry picked from commit 577ddca90877e377e5b40c8baa15fa5b7a3c9965) --- usr.sbin/bhyve/snapshot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 6143f6f3a489..37aba32a1929 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1517,6 +1517,9 @@ init_checkpoint_thread(struct vmctx *ctx) int socket_fd; pthread_t checkpoint_pthread; int err; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif memset(&addr, 0, sizeof(addr)); @@ -1547,6 +1550,13 @@ init_checkpoint_thread(struct vmctx *ctx) goto fail; } +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_ACCEPT, CAP_READ, CAP_RECV, CAP_WRITE, + CAP_SEND, CAP_GETSOCKOPT); + + if (caph_rights_limit(socket_fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif checkpoint_info = calloc(1, sizeof(*checkpoint_info)); checkpoint_info->ctx = ctx; checkpoint_info->socket_fd = socket_fd;