From nobody Mon Nov 6 19:20:11 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 4SPLlb2qwfz4ylbX; Mon, 6 Nov 2023 19:20:11 +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 4SPLlb2HK4z3F6f; Mon, 6 Nov 2023 19:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699298411; 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=iApXQzCZ28/5Ch/MgYkctyWMcM7ikzP03Lm7adwLZKA=; b=mFFOmkOiYKbxhC48SzUuJOtvJERzUXuIaFmETfxJEHEr+IF0TfnE/+a7/SgmvRgkUkGHab d5ICV5lzEOok8n9rBRNmG+WaZBppca/kshWNrhPmAYPop8vkoYT35AYRzE2/nAF3i3mbro yu3VLjQegrXljMKdJUsbOzYWLV4NTFwwhhz2bOPtUM+gBcvkkoiRKm5I1d8x0S6SxKHToR 3klaoewVk1SToEcqfOam4B2GmcaHpqp323S4Tzhv/mK5hLzLap6Pqmt54us/6Qg0jkBBBU Cn/0RdOEuwtgOuS20CSgo2F+0ch9Rg3aL76DutBYAMaxFipWDRjbjL3LzBw/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699298411; 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=iApXQzCZ28/5Ch/MgYkctyWMcM7ikzP03Lm7adwLZKA=; b=Jz9YOBC1XS6OfEMhKo5y9p2ff6FXJ7uVRUwiZ8RueYHrPKTYpPdQwiaAMhfAaGLJwwA6Hg BrLQAoL3ilAXUGFqA/mTRiWaf2kC/HrYLsDaGllTtUyPEWA+FojHCz2+8fElAqgAPqRt+X C7bI1ZgxOCsqHrVwR9iN0jJsYF5Z9XqJwAZwO8+FLIE8GifIV9edXxx00fj3cHWO6MFD8S DAKarwddW59HWSf9FAhdJJLjAbEw4AA4te+jFEGi+/OPJizmr1HCS9pwLhkvt4nzX9M6Fo ZPaUVMpTIM70pCL5c2V9JpXzYqUvDPE9Qk6WORPepp4NftAcBYKBwfMKMoE04g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699298411; a=rsa-sha256; cv=none; b=bP4n+JeE1Y6fmhoxJND4gqnaKCINYIHAvcjCeK+MQgcNx+A8dlDUBOu1BJJyoHbmJ1l2Tq 6MOm33ZmrSLBtdy6zMX0LN/ZwVsGAP04Qh6tER/rTqoqvQA7506HRlprWphq8doyUqUX6/ dQOl2NmKX6OkZ1roWb7noQdCPTqEF6NB0dUUBdmhHtAormm7C0O/2gf+EfemR2pB/yU3lu WbrACGX5jF+lLg2ZL9u+zWJLRNYIzbrYZdgtQc5rIYlSBHEkaXNX80brgcYMTAxX/A6WnF Ihu3GAgwd9jrmBskxWmPRQ9wA5fYthfYYcSnp2kCokmzCW6PtElCZ9hYG4O7rg== 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 4SPLlb1NtQz4lX; Mon, 6 Nov 2023 19:20:11 +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 3A6JKBIw016263; Mon, 6 Nov 2023 19:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A6JKBTR016255; Mon, 6 Nov 2023 19:20:11 GMT (envelope-from git) Date: Mon, 6 Nov 2023 19:20:11 GMT Message-Id: <202311061920.3A6JKBTR016255@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: 114c6d9bef76 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 114c6d9bef765a47ebcb8e65d1c935cbcbe51002 Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=114c6d9bef765a47ebcb8e65d1c935cbcbe51002 commit 114c6d9bef765a47ebcb8e65d1c935cbcbe51002 Author: Mariusz Zaborski AuthorDate: 2023-10-23 21:03:51 +0000 Commit: Ed Maste CommitDate: 2023-11-06 19:19:54 +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) --- 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 06fbc780bbce..c29bc36bf64c 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 989a98f3ae22..86d771fc97d7 100644 --- a/lib/libcasper/services/cap_net/tests/net_test.c +++ b/lib/libcasper/services/cap_net/tests/net_test.c @@ -742,6 +742,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); }