From nobody Mon Nov 06 19:19:27 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 4SPLkm1dzjz4ylX0; Mon, 6 Nov 2023 19:19:28 +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 4SPLkm1Bhnz3Dtk; Mon, 6 Nov 2023 19:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699298368; 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=9OZ8or32h6Ir0iMSxrZe4kRSKgbOSZv2WX5DRDP2JuY=; b=GX7uh/SiWJX1p61elendNH72pz0qT4jhteme2PH2CItsimkKeb/zwtw1Cz13GSOiEINNS4 hj5YWVNOf8+N87DArCtSo75/XnfC0oA7wf9oXhE4zktESVo+FevaRtZAme087++CHvnTNE 9qogPe9cgc+cjzMgBmDh+3SL31FJPuSaIjEJQ/5Ry1TQFMRBzqr8tOOTdTpC2iem+UFcpZ 6EI65pdMOKAdUZZyB8dluJOCYnImMGjZB2YNLuFv+ktR5HviTEAdc7HhJgpe40DAzHHXWV Mu8gZrP09dGvRsCStfTjJ93PaW9nWDtybLGdsZ9jnZyRgrAsSoUNe9fpsU8zbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699298368; 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=9OZ8or32h6Ir0iMSxrZe4kRSKgbOSZv2WX5DRDP2JuY=; b=J7i2x3Z3lKKG4yItCCZx7EmeXarWTD4w7afKvBm/i7WXeql9wgV8M8GZFvCfGUziRPfJ57 kDVdyYKVijo9XPxwvQ8zCI18s9G8U4XUOJIEF+xQNMbrTTcQOYA4pRGwnFuXlRyostio9b 0Xpmmh8v7kiRMDlpBfo0aMI1OZ7etlO66aAbdDs7YWRSPgdPMnncM3ZAkfFsRBncRFtl7c 2nl5NWuK4/tHHkylBtI9PRUixWRuks4hg+/4LYfoaw2mCeSxr1xjvIYdHp+cNKp1MutFao vHnfqpFSmQWk+53tqKdp5zRI0/weySKPvgGndPtf/Rt3ORWNEx/i41nrDSbqNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699298368; a=rsa-sha256; cv=none; b=mu1GzxghilfmqLhfKfGNSYE5ZT8ymA44DbL6xulsaM185tdR7F+pukQVRo0tw7kuXYbVIP 2IsEKETJFuv9X8bhfyCd3a6Bl4grIsNZyvmFXvvu3glfC2hKCSt7P2oKMWym4uSN4crQfu KuDxK3qy9Co4tuUzFRIadeKhbG3vX6/cyKy3Ud4LCVPqiVKOXuMp/kKFnQYu1BWiPcxgCb Xjb5DDhDdb+MvkLelSi9RM9CCTtoiii4cc2UL1AElLZVeLsoXmpuZVFtczzxaRoFo02baR FYEQFX1qfwc9hPj7S0knzX9V0sFhWss+PcAQlDjKpN4xJ2FaQiAjJ8ytAlrWnA== 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 4SPLkm080sz4kf; Mon, 6 Nov 2023 19:19:28 +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 3A6JJRTD011518; Mon, 6 Nov 2023 19:19:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A6JJR43011515; Mon, 6 Nov 2023 19:19:27 GMT (envelope-from git) Date: Mon, 6 Nov 2023 19:19:27 GMT Message-Id: <202311061919.3A6JJR43011515@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: 765757c6301f - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 765757c6301fa41c0b59108347c600fbc9020c39 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=765757c6301fa41c0b59108347c600fbc9020c39 commit 765757c6301fa41c0b59108347c600fbc9020c39 Author: Mariusz Zaborski AuthorDate: 2023-10-23 21:03:51 +0000 Commit: Ed Maste CommitDate: 2023-11-06 19:19:04 +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) --- 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); }