From nobody Wed Nov 08 00:45:55 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 4SQ5wz6fzhz4yvXJ; Wed, 8 Nov 2023 00:45:55 +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 4SQ5wz62rPz3RBb; Wed, 8 Nov 2023 00:45:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699404355; 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=Ff0rTKAqnF4nPrMFvI5Gh1uFsPBW0cKY/y8zCOYXl8Y=; b=F+Ap34aX46qOfCyw0M3tsDhK8rqawgoiZWt6DaY4wGW3gLtbojWsP3jMkif1wLSqKt5Fxc 4c2hXcY+Mz9fsZh9Mks2xEvz//yJoIKdlW805K10ZM3Uax/9sOr26V4bRsH7c8XE4yFlai v7Tk8VZAd0fxbYOX9+lTbp9Pg37/Hh4YURZ9Td0aVaa+UFqlwWJ/DGzF+FL8klvDwmnBzB fl4LjglGZPI3M0IvPBfYvciQU4PYeVMgqPZGgzntwueStUGm8sDYn5OF2JUc12RU3rXaNR B3cb98Nk9Wq999m3jEOMoawclwP9qE67TC295vcRdJDaYM59hzf2T2XmRnH1Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699404355; 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=Ff0rTKAqnF4nPrMFvI5Gh1uFsPBW0cKY/y8zCOYXl8Y=; b=H70HE2yKqcreacRQImKdIaa7UYZtUybf4ySEZCLhLUY0whkM6PVJeLy9e9glzBccmeLZB2 ixM4/HAvftlkGtjCxTKb8vOTF5bIo+8RvJZLN05ZsX+pnWlnJe3jpA1Kut+1mvAHhxxeYX X735ky/uD0ZKK0yRqoUWwAy4DqpCCQitqXn2sHGWuecfuO10RrW3ezYZyTxSTJNhyaBEd9 F+4ERYu//bSEIKllYthURRwYd3TlnYEFqZvUFNjmZmAH4SSkArBvGJRlSDw5s3/LFWUZ4w AnlF7YcVcBXnTtIxogaKkTsXb6L/TR0DJ89XZbUCh45W+cE0RXBkNOyl305Tog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699404355; a=rsa-sha256; cv=none; b=uL/677r0/o6ZM4NTzr3iHoAwxgY4HsGObEjfSCdZa0Tn9InKREAfRQq8ayTM71IqaDH5xp wmNEQscDrbYngwUNMCd4AuD3gcQ9uonLIdwp7nPnW1wQn2GuG8VaBW5PcpcB50OLAKv9xG PR7UStN+LSbXFtxRtW2G0R/SNt+4ThUJJetYGdDXv7w3BFdfuCv2r1TjVs0b0tApXCXLhn 82+59bVeWFV2h7wRFiITcPhoS+5pq/nntyCqZ0Doy0tHKvjtrAQwhMTy/Bfj1+L+Ghtrcq mHSIqXNigqqXxTEW21BAZUmXMPWtxgqqS3TaXUZzGjwI3R9K5A0aLHXgyhFNRw== 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 4SQ5wz5871z1BnZ; Wed, 8 Nov 2023 00:45:55 +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 3A80jtSK071222; Wed, 8 Nov 2023 00:45:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A80jtvY071219; Wed, 8 Nov 2023 00:45:55 GMT (envelope-from git) Date: Wed, 8 Nov 2023 00:45:55 GMT Message-Id: <202311080045.3A80jtvY071219@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: 5f4fc91cc87c - releng/14.0 - 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/14.0 X-Git-Reftype: branch X-Git-Commit: 5f4fc91cc87c99d9995fd05e6029960d692bb397 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5f4fc91cc87c99d9995fd05e6029960d692bb397 commit 5f4fc91cc87c99d9995fd05e6029960d692bb397 Author: Mariusz Zaborski AuthorDate: 2023-10-23 21:03:51 +0000 Commit: Ed Maste CommitDate: 2023-11-08 00:45:34 +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) Approved by: so Approved by: re (implicit) Security: FreeBSD-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 bbb2a666440f..a8f039f81843 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -1232,7 +1232,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 5522f92516eb..dcb897de467b 100644 --- a/lib/libcasper/services/cap_net/tests/net_test.c +++ b/lib/libcasper/services/cap_net/tests/net_test.c @@ -783,6 +783,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); }