From nobody Mon Mar 06 13:05:29 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 4PVf2L1LwQz3wt7v; Mon, 6 Mar 2023 13:05:30 +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 4PVf2K5zkyz3HBp; Mon, 6 Mar 2023 13:05:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107929; 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=n/iqIvGin2FgMPV4X00MTwAohzHA+nSepbAWs3opchc=; b=Umrky5/mRFSa8jnxGn7Y1iCcJfv0KGtsK8nnKagj3hdxu9DLnhDdfk1OaNQ4ajsM0ZcSiB gaIqkFn9f21LfD50SzhXp0UOkP9jxCS0orfAWbJDcDnG8Mxx4wlEqUCv8ZC5P9D7WQkojd pV+cgHm3oSTfL1rkWPS5xs5RYTbzP4wSAZDCVF6r3DCMqztI/NXtqe4cgfCjlWGbp9FF3q r4qUy2lw4DvPYNOiaDcvANtSf62V4o+OPdLC7WnvpL0riNmAOwX1BChzXpH+sjsiBVfwP1 2m8VRrZMpnAhEond+2+ribr1Pyq7gO9PFMYYuAB8diXVUy6iBrTuHt8eRXRgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107929; 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=n/iqIvGin2FgMPV4X00MTwAohzHA+nSepbAWs3opchc=; b=eONg3JWvc8pcLp3gIdAYTNqby/SfoWTzEaU/ffLlymQmMDSeT+3SKofEjm+BwYc2uEVkcG YOdfaXh5r39zz6hqmCseWWXL4ViXM5qz0kZTQuBSCYDhdxpS1ZCfZ60D6I+pK9yoyLht6S +VUEqURkxD5A1SyhbyqN1Zxv6qprA7MQGoFUWjtbDfYGmnvQjUUbKqJ2XztLqaRtMPQoWi XXH65pdfE2A/oHnfPBK+mjZcJkbhCQngN4HBSFUJJwP7inmF59H3+/dDia6O74z/GwqvGk 7qZERvwB5ikhlENbzDirtM2gn+kO2JalANhYm6QiJG9IPW9EKZES1Y8knADEiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678107929; a=rsa-sha256; cv=none; b=nMr49/H4OTcQepugLmWqZvhOYL7ISU4bRr5ZgBhcgdz21u1pEgTDLMFMs5ZExyWdqNbEDZ GsSaMGC32QR0EEkafaJIv0R64R+85dRS/hz/6O8jdkJrMUUlmagUaVvDi2mdai+HJ4j4p7 0CHN24PIcP2EJcaC65VzfeMrD+oEiidrC171UDV4pEqJcSpQugI6JonwTU0irYPGDyyGLU +OEXE/GNAgrzZbd5YkxWLe0x8HZcnHQXSFmPWOqNVX5bEg9NJYWWyUcH9A1mI4ntZ8mb8S GPPOyqLPRCf5RRdxa5s/Lo7S8gs9NirTA/W+BVAowmmL5pcsFseKVuJ8qiaHZA== 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 4PVf2K55M0z12rf; Mon, 6 Mar 2023 13:05:29 +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 326D5TNp079470; Mon, 6 Mar 2023 13:05:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 326D5TcZ079469; Mon, 6 Mar 2023 13:05:29 GMT (envelope-from git) Date: Mon, 6 Mar 2023 13:05:29 GMT Message-Id: <202303061305.326D5TcZ079469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 577ddca90877 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 577ddca90877e377e5b40c8baa15fa5b7a3c9965 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=577ddca90877e377e5b40c8baa15fa5b7a3c9965 commit 577ddca90877e377e5b40c8baa15fa5b7a3c9965 Author: Vitaliy Gusev AuthorDate: 2023-03-06 11:36:40 +0000 Commit: Corvin Köhne CommitDate: 2023-03-06 13:04:11 +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 --- 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;