From nobody Sun Mar 5 09:40:26 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 4PTxXC02Yhz3wH8P; Sun, 5 Mar 2023 09:40:27 +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 4PTxXB6fzNz4CdS; Sun, 5 Mar 2023 09:40:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678009226; 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=BkSG8XdN0iZc+mQUNXhM7SFuXW5ZOVC7/c/A+4o4ck8=; b=fWLbZaKu7Y2KcVyNgJ/9+IlcHM6w2KtiE5LSaeN0XLcODAieboG7mS8BsQcs/H+rwody9C MVwmoqusKfmNPrbcJsW6/3Q5Mi7HoxLFWVU1HCshH0p0Qg7nBj74gEhMUyxn6mEVFvSwyv o0mWh7kNXshS+v+RL1eHOBSvppcMWhGHGwGNBgwqTVfdK1pt6I1qyQea6CnnzxvdwU1S5R w7dY+N7ETnHdjJJuiMRWdrpP98t3EkyISISZhjA6gKF8Udf1qQnp0PwDjAPis3cXqZOHtJ xHDh+6mWbMr3dJT795cDgsRyuQXz9MTONE/td8xKQsYNiVwI18k7mxvtEcO0Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678009226; 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=BkSG8XdN0iZc+mQUNXhM7SFuXW5ZOVC7/c/A+4o4ck8=; b=eYVL6JFkA4oUXWrvUsCsWRl38QI+jdguw48eZVt7zdpdY1AiGn7aeyCVQ74BK3jIwH2sal kXxAGAO8HawWfVWnkNRKGwyYsBCzOrOkYET/hJ1vjtO3dlj5UqnG0eEkUiUqmWPpDyNrgp JN9KvGRxPRsIYYrUn9OsMSxYTKzqnmvwloKQ6oRQdy3GJoeoB4nrwgGrInUk5W2tKMpryu BJN2SEGJ7ly95WASkqnwNVrb2v0R1/ptNY8wH94KwgUs5ELDtFXECm2xfAOolG9SdYGKAr VeJV2Pb9AbJE8Br9xl5rf5QlKvG6g6G/YNltqfAQbnulEtQW01x1+BKCeZAR4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678009226; a=rsa-sha256; cv=none; b=QnnnzrkHv/PaasIxAaX6umkcvf+KYrjzOj4ExkuDN2O3cnAXSGRuCDyxdLESxI3Uu6trNK SqPN6G3UbuvRvEIG46muR9caDGeyJYM+4X9LUzxIlC8clL26QB5kxltNenEsbIoy1jp4Lt y09+mhENlbb8PNlZtRWh9ywpKa1IZ4BU9NFP+b02p17betI985I8jfAEilw0yx/HIFBzri MY+ToeiItlTYa2c0WDNuG3NkkXE1PjQzOdlnyxexf1G0G98U9D6uLOi4LU/rZnfgSXNRWo VappCAhdXKipVlwOMPnSu+iA+Dhtp8ADm4v3IytxOIRtKOQOT/yte+uGj3GqXg== 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 4PTxXB5kFJzGqM; Sun, 5 Mar 2023 09:40:26 +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 3259eQRc081069; Sun, 5 Mar 2023 09:40:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3259eQY5081068; Sun, 5 Mar 2023 09:40:26 GMT (envelope-from git) Date: Sun, 5 Mar 2023 09:40:26 GMT Message-Id: <202303050940.3259eQY5081068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: c237c10a2346 - main - 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/main X-Git-Reftype: branch X-Git-Commit: c237c10a2346dec422233db05b2012afd45363fa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=c237c10a2346dec422233db05b2012afd45363fa commit c237c10a2346dec422233db05b2012afd45363fa Author: Xin LI AuthorDate: 2023-03-05 09:40:13 +0000 Commit: Xin LI CommitDate: 2023-03-05 09:40:13 +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 MFC after: 2 days --- 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 a5841b370302..3625393a5dc7 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; #elif defined(HAVE_PLEDGE)