From nobody Thu Feb 15 03:33:50 2024 X-Original-To: dev-commits-src-main@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 4Tb0z23bklz59v0y; Thu, 15 Feb 2024 03:33:50 +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 4Tb0z22jPQz43Gp; Thu, 15 Feb 2024 03:33:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707968030; 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=EhWwd6D9jmKF8CDv2rV2XP/y/GaD6vMtX3nOZacYVhs=; b=GTEX4ClInfjEKsqHwlsVdh0Y1kiETGYdCRXrcRUs9MofhSP3/EuEix//h6eQJZDdUcQhld ILufV1fOtzQWLotMKjJKSR0aaz5yn+fnS9a00HzSQ+VfYF5HbQLJdZBDAPKCpYC4cU32rU kxmzFEpyLMph0gO7mHC+MztLg2jzMNqGrAW9kyI7iQPdCHtDV7EDn2pd+Rz8qTRHFAYRNd wJzImO+uXoLCQTlH0X/dp8y5gkyiiichMNnv13QtTMyk7tTonDts0v+Tc/SXMCmyBnFTrh YpwcwgknZjOg6JcK/uRZW9IJOYXfGhsh/0r1aU8cZzRUylwZL443Vx+b3nvAxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707968030; a=rsa-sha256; cv=none; b=Oj4y6HC1ekMF32LM7E+8/DNL2hhtHktNDuHGlSuEUTphfnP5BQWre/s4+TOqPE43n0AjLv yCGo4x+yRmBfCPnXJzYHBpqgUFFIBbKdoU2KSJQDk4/ftQ9qwxzkz//LSpIkbxGuuz5MaD G5+U+mOVo2OronYvfLyhdJ+udHF87K4U0dl3Urh7qt8CE8/eLPUjt+znuF6EOHwROwymXo 7cUrmycTY7z0WssDdVsM64EC9wfJ4bAluBsAlthAFV+/vJPRTuxEsfesoc3dHqtHDXoD83 cfZbCqpIU8rL3S01S6VRUKmTVzkazT4oyg6iWhBKZUInCOzVpGOp/AdfXZC//g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707968030; 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=EhWwd6D9jmKF8CDv2rV2XP/y/GaD6vMtX3nOZacYVhs=; b=l3YCoDRSg5vm0Rqk+6iDiQEd4vh+h0BLI6f0nQFP2cV3xEvV4J1ipY9UVFKU6I8pra5uDQ li4a4t1sbxvywNR4oztXA6zpsGb+BYavIA7pMDGshzCpf76kZNBJDOTkZCtDJqGU3AgeAd 03ogZvxjeAou8n/s+Gx945uXKfR2258A3tI07sqw4X4POiiAORY4sRUju/mnTNhvd9azrN wvVszj6pORlzUycoxnIB49/fK1IZqy9WO54Q0UGzlNu0kGVK17+1HOgJGfp7hqgSI0wfW3 753F8PeuQvvWUSI5VgMGrd6yRjrJhTef/1z7Gguoo9CGfhahd7xom3u7eS6sgg== 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 4Tb0z21mpwzQgQ; Thu, 15 Feb 2024 03:33:50 +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 41F3XoQS057377; Thu, 15 Feb 2024 03:33:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41F3XooF057374; Thu, 15 Feb 2024 03:33:50 GMT (envelope-from git) Date: Thu, 15 Feb 2024 03:33:50 GMT Message-Id: <202402150333.41F3XooF057374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 3733d82c4deb - main - libcasper: fix cap_rights_init usage List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3733d82c4deb49035a39e18744085d1e3e9b8dc5 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3733d82c4deb49035a39e18744085d1e3e9b8dc5 commit 3733d82c4deb49035a39e18744085d1e3e9b8dc5 Author: Ed Maste AuthorDate: 2024-02-15 00:42:48 +0000 Commit: Ed Maste CommitDate: 2024-02-15 03:33:24 +0000 libcasper: fix cap_rights_init usage Capability rights passed to cap_rights_* are not simple bitmaks and cannot be ORed together in general (although it will work for certain subsets of rights). PR: 277057 Fixes: faaf43b2a750 ("fileargs: add tests") Sponsored by: The FreeBSD Foundation --- .../services/cap_fileargs/tests/fileargs_test.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c index 7d499542abe9..088edaaa294d 100644 --- a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c +++ b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c @@ -291,7 +291,7 @@ ATF_TC_BODY(fileargs__open_read, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN); @@ -338,7 +338,7 @@ ATF_TC_BODY(fileargs__open_write, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL); cap_rights_init(&norights, CAP_READ); fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, FA_OPEN); @@ -385,7 +385,7 @@ ATF_TC_BODY(fileargs__open_create, tc) prepare_files(MAX_FILES, false); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL | CAP_READ); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL, CAP_READ); cap_rights_init(&norights, CAP_FCHMOD); fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 666, &rights, FA_OPEN); @@ -466,7 +466,7 @@ ATF_TC_BODY(fileargs__fopen_read, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN); @@ -516,7 +516,7 @@ ATF_TC_BODY(fileargs__fopen_write, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL); cap_rights_init(&norights, CAP_READ); fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, FA_OPEN); @@ -566,7 +566,7 @@ ATF_TC_BODY(fileargs__fopen_create, tc) prepare_files(MAX_FILES, false); - cap_rights_init(&rights, CAP_READ | CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FCNTL); fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 0, &rights, FA_OPEN); ATF_REQUIRE(fa != NULL); @@ -672,7 +672,7 @@ ATF_TC_BODY(fileargs__open_lstat, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN | FA_LSTAT); @@ -720,7 +720,7 @@ ATF_TC_BODY(fileargs__open_realpath, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN | FA_REALPATH);