From nobody Wed Nov 08 00:53:01 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 4SQ65B0ZjTz4ywbW; Wed, 8 Nov 2023 00:53:02 +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 4SQ65974Rqz3SbH; Wed, 8 Nov 2023 00:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699404782; 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=4G2u94cqk4r7VTTW9MUnq3/F6emHaBLPLdUGIrbQKZE=; b=jcC1MOKdIrfz8CZetqTMgpmTscMYhuGpQvq0MGAA1DSpWfVHyKL5ys5xgudKpdXBhhkuR9 QCcedVSJNkfZp/1DxqwWJx9w0X3A2EQveF8bmQX24eeISYQPYkSTbJVknxoDZkV0foISvz jWT6HiVw5qvlfM8CGP664BVd6KQhp44l/p5XxdsRKC+9E6YxDSI7yhKXRBRWaucKvpw1eQ jrvpYfuzyFdA+19FAuyNVjn4gUwfMBohOAdhYqPfVJUGkgE3HT1YHD3+QsqmMF2KwuU19A nIFvSN/2fvRNVHMnymu18HtXWqXdpOQeWkVqyeBpASZCjljv7UZDEhL1tSduPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699404782; 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=4G2u94cqk4r7VTTW9MUnq3/F6emHaBLPLdUGIrbQKZE=; b=wq+BcjYjPmu0K0+4RZ+brhjNjGKe5Yyb1bj0ad9qx/6lFY6xX5nMM43KVRK604yc08MSTQ GWPwCck4crK6PepS9titklXJ5z+Inf3tvTdutINn919yWYOqM6tlQgB/Gr+6qhLO4YTWET U6wFqX3RAaL7NlY7HrCWg4+adeI/SYYdRJeP6akuIukada+UvMu4eW7vtZb8rUJlZ7IrAF t28XHXWBwCK0JXXZ81mM3Gg1bvNOEcWg9K2Rc1w6UiuDYBos5JltHZ67IBoJbnTzdyKTpi GbjO3zABUhV4sa+YKbwBR7aTQDqzgWWsa8+WPfhu2r2GgEna6/bS6CEWaT6VXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699404782; a=rsa-sha256; cv=none; b=pt2T89Qx+J8PDhQI1RNMA6gDANKiVg1D9jMHP1XpkH6rofa3okBDWjKD4S3xrfpncULKnw 1e0mHAvTd72mts4iOwJe17XgFaQGV07veMnTypiUKZSY9fNqSNJWrNfOT3VBGL/W/H2+uL LTots1CQgm56V1r2ozhKDUJRVKV+gC+gJLVd4Af/AMxjiIKblv6Vj8sdObuLyd9bF1ScIX BKVmGMKoW2/x7fiyPGjQor+rdv18dNOD6dioxKYKWDx9Cfgp9BlnuuHJvwgZ4mrLrP0bP4 zOJ/dbF7yVGdAA+tGlrWFgt5Md+Mf1EB/JhIWTPajpSbF5B5+L9ztTC2vBaf3A== 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 4SQ6595xdtz1BRR; Wed, 8 Nov 2023 00:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A80r177087399; Wed, 8 Nov 2023 00:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A80r1dU087396; Wed, 8 Nov 2023 00:53:01 GMT (envelope-from git) Date: Wed, 8 Nov 2023 00:53:01 GMT Message-Id: <202311080053.3A80r1dU087396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: acd860c3622d - releng/13.2 - cap_net: correct capability name from addr2name to name2addr 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: acd860c3622d2591f4eeaaf241094c311c5c642a Auto-Submitted: auto-generated The branch releng/13.2 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=acd860c3622d2591f4eeaaf241094c311c5c642a commit acd860c3622d2591f4eeaaf241094c311c5c642a Author: Mariusz Zaborski AuthorDate: 2023-10-23 21:03:51 +0000 Commit: Ed Maste CommitDate: 2023-11-08 00:49:31 +0000 cap_net: correct capability name from addr2name to name2addr Previously, while checking name2addr capabilities, we mistakenly used the addr2name set. This error could cause a process to inadvertently reset its limitations. Reported by: Shawn Webb (cherry picked from commit afd74c400075d94e01dd3430844bb290834660ef) (cherry picked from commit 765757c6301fa41c0b59108347c600fbc9020c39) (cherry picked from commit 114c6d9bef765a47ebcb8e65d1c935cbcbe51002) Approved by: so Approved by: re (implicit) Security: SA-23:16.cap_net Sponsored by: The FreeBSD Foundation --- lib/libcasper/services/cap_net/cap_net.c | 2 +- lib/libcasper/services/cap_net/tests/net_test.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/libcasper/services/cap_net/cap_net.c b/lib/libcasper/services/cap_net/cap_net.c index c6abaa69faf6..ca9434adc6f7 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -1234,7 +1234,7 @@ verify_name2addr_newlimits(const nvlist_t *oldlimits, oldfunclimits = NULL; if (oldlimits != NULL) { oldfunclimits = dnvlist_get_nvlist(oldlimits, - LIMIT_NV_ADDR2NAME, NULL); + LIMIT_NV_NAME2ADDR, NULL); } cookie = NULL; diff --git a/lib/libcasper/services/cap_net/tests/net_test.c b/lib/libcasper/services/cap_net/tests/net_test.c index 49cb0da44a4e..34661339340a 100644 --- a/lib/libcasper/services/cap_net/tests/net_test.c +++ b/lib/libcasper/services/cap_net/tests/net_test.c @@ -708,6 +708,18 @@ ATF_TC_BODY(capnet__limits_name2addr_hosts, tc) limit = cap_net_limit_init(capnet, CAPNET_NAME2ADDR); ATF_REQUIRE(cap_net_limit(limit) != 0); + /* Try to extend the limit. */ + limit = cap_net_limit_init(capnet, CAPNET_NAME2ADDR); + ATF_REQUIRE(limit != NULL); + cap_net_limit_name2addr(limit, TEST_DOMAIN_1, NULL); + ATF_REQUIRE(cap_net_limit(limit) != 0); + + limit = cap_net_limit_init(capnet, CAPNET_NAME2ADDR); + ATF_REQUIRE(limit != NULL); + cap_net_limit_name2addr(limit, TEST_DOMAIN_0, NULL); + cap_net_limit_name2addr(limit, TEST_DOMAIN_1, NULL); + ATF_REQUIRE(cap_net_limit(limit) != 0); + cap_close(capnet); }