From nobody Tue Mar 7 06:56:32 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 4PW5p86M37z3x0xZ; Tue, 7 Mar 2023 06:56:32 +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 4PW5p85kp8z4KMV; Tue, 7 Mar 2023 06:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678172192; 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=xuZ2FrKrCBkZovG2NkjbpaPsBwkNEAllnEB9lM9iHG8=; b=l7DhhuYtbn74qZ2lJzq15pJkfRrI+/rfZQ38HuvXWSWG3uqTK4W7mHtIpO6GRFm/pAAj0L QZH5Kl6nTyDRG8CiPu8dIZ7vVkmjeO/sqQUTEuc6eBZI2+FKWxY/V8roK7ersGmFSALnLg coBIAtkORGczXT8k7zqLzujLHvpHb6j4x94KgS3T5eYoJgTHgwrkXpnNviO5HLgc1V1oWP 1F5TkHrrhDYGOxDoS9j95g05+3jLUfNAPBTtAAo2p7Wr5zBPsLdgqMt6QGMm3zLHO13ss9 5qcE99h+3UeoCupzbc+5sxKOHo6+6D9KCAl3J5S2zwnnhqBxxPatI+vy69GwxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678172192; 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=xuZ2FrKrCBkZovG2NkjbpaPsBwkNEAllnEB9lM9iHG8=; b=wLeBjzCk4fJasz0kAWhSC2n43U46xLlF3K2vuCr1kzCWHDSXEmTUrvMhXoF6TfxsD9xC8a Jw4FS6431s/wVzm39fue12FRfX3tDiZ97BZ8TqAFRNmlgeno4ZOX55cUmv5OASLokUDMPF WdQeY9oNewQuPpkTDLdegVpx+EOY1StN7bRl9xEk4ipE+JYUnM+tMrpm7mDXd2zRdBojx2 Ewt2Fp6orfA1G4n/e4shH7CaELi/1IPNBqPKqRxWlc9q9IwkN5MusROqVYVoj61YWqySyM XzEdJ87NuLnqWWn5SfR65+aGTOhWtX1WXF538g5jJIjpuIx4pa7cqmiUPawpHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678172192; a=rsa-sha256; cv=none; b=CRYQ/vBg8lNBeMAYszspuH85AH8T32q1kYHk9qqTPQbIWV9dfpxCTJsDs5rhCfgY9HYjw2 q/wNFzbEWy/YSo8YF1oWMp/oyy7JWINlEuW0eyjoKoz+m9bpk2hRzHRlrpbSvqNTCrT4Cq 4m5Xm7grEyI60M0oYNXWxa6iHv736Ud95nnSdN+3GDUFVoUSmW2nrbxRhmBFseuIFh4x0V mTcaJQgkqA22Mchjc6e0ErZ57OI4Z/iWY87Q8aDrikKxzyyBAJlb6CnvkeOkm3WoHDBMtJ 7a1fTUqSxP6LnqJcCme0TNnFqkBhMwaIhXNqfwvxfSW5W0ecDj0oqPLkV4mYCQ== 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 4PW5p84TDszYl1; Tue, 7 Mar 2023 06:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3276uWSf037614; Tue, 7 Mar 2023 06:56:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3276uW89037613; Tue, 7 Mar 2023 06:56:32 GMT (envelope-from git) Date: Tue, 7 Mar 2023 06:56:32 GMT Message-Id: <202303070656.3276uW89037613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 2e12642a6595 - stable/12 - xz: Improve compatibility with systems without capability mode support 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: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2e12642a65957e7ab518699e1f8a9a5aa95ea45f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=2e12642a65957e7ab518699e1f8a9a5aa95ea45f commit 2e12642a65957e7ab518699e1f8a9a5aa95ea45f Author: Xin LI AuthorDate: 2023-03-05 09:40:13 +0000 Commit: Xin LI CommitDate: 2023-03-07 06:56:18 +0000 xz: Improve compatibility with systems without capability mode support When the kernel is built without capability mode support, or when using an emulator like qemu-user-static that does not translate system calls, these calls will return a negative number and set the errno to ENOSYS. However, this error does not indicate a real programming or runtime error and is generally ignored by base system applications built with capability mode sandboxing. Match this behavior by making xz(1) to ignore ENOSYS errors when calling capability mode system calls too. PR: 269185 Reported by: Dan Kotowski (cherry picked from commit c237c10a2346dec422233db05b2012afd45363fa) --- contrib/xz/src/xz/file_io.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/xz/src/xz/file_io.c b/contrib/xz/src/xz/file_io.c index 41e4c2d893f8..6adbb7a6497b 100644 --- a/contrib/xz/src/xz/file_io.c +++ b/contrib/xz/src/xz/file_io.c @@ -193,23 +193,24 @@ io_sandbox_enter(int src_fd) cap_rights_t rights; if (cap_rights_limit(src_fd, cap_rights_init(&rights, - CAP_EVENT, CAP_FCNTL, CAP_LOOKUP, CAP_READ, CAP_SEEK))) + CAP_EVENT, CAP_FCNTL, CAP_LOOKUP, CAP_READ, CAP_SEEK)) < 0 && + errno != ENOSYS) goto error; if (cap_rights_limit(STDOUT_FILENO, cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, CAP_LOOKUP, - CAP_WRITE, CAP_SEEK))) + CAP_WRITE, CAP_SEEK)) < 0 && errno != ENOSYS) goto error; if (cap_rights_limit(user_abort_pipe[0], cap_rights_init(&rights, - CAP_EVENT))) + CAP_EVENT)) < 0 && errno != ENOSYS) goto error; if (cap_rights_limit(user_abort_pipe[1], cap_rights_init(&rights, - CAP_WRITE))) + CAP_WRITE)) < 0 && errno != ENOSYS) goto error; - if (cap_enter()) + if (cap_enter() < 0 && errno != ENOSYS) goto error; #else