From nobody Tue Sep 12 16:44:15 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 4RlTv36gQWz4stxR; Tue, 12 Sep 2023 16:44:15 +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 4RlTv33lgbz3dpn; Tue, 12 Sep 2023 16:44:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694537055; 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=w8krLV1Y/jSr2LWiXfQQ+fek2oxm2kQUqs2TmZS/baQ=; b=TeibQqNCaFBuehpoEaBEZ5nCtcufj4zYGpJHcGCq8mNEECJdYiZ1ZlDvbRQNZcTIdrJUyh 3ghwpDcDzqUfswx2KmzXCvXtF+KH0276X0uLqFOESBIghC+M49jS34e6o8+mRSBQkccgE0 1BR2Fc1QVe3w0V8rV6jf3NBzCD1zhEAuThTsTh/1irzDgS/tszvsmofYde527Hnefc4ElD 5U3GJkzH3omNbamTR5ps/ctFeYCITLtT/7wne+ABYgb3PRrjog6D2eoTydwJn2GEmH/9xa YBGGH272101W37Q1tWvypdlK0IpMPAiZoRc1Kah+QnDC5yJiCWmkMIa7CTuzuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694537055; a=rsa-sha256; cv=none; b=bgVIWr2JvvpQ+DXF8lgq5KvQpeLdjBseBnmLp9I+X3Ytv7+VFAL8+DagtCnexm7E1ShKL0 ajwsuzI/gbXYugqUBTZIa/zTMuuksF0ufpqcfZiVEdSCLk49ISUkguvsk2jxJSkNWp7unl RHyABEMjgoW8nqGwvFAgL0syLKEGesPVCLyBQwoN6WbcEfCp87vNpeRGL/Tx8bnQhkw4Yf F3bWMasojw/h1n2NLvEdY/HIK8kdA/RVzeH4UIgJCBE1Lei9YLA2CffZGRa0eTV8uj6isp UKwciWTr5Ovkn2J4EpERIdcwRU4g5wsddXbWYxG1aWpS2kIFkD6xvNvZkhunMg== 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=1694537055; 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=w8krLV1Y/jSr2LWiXfQQ+fek2oxm2kQUqs2TmZS/baQ=; b=VwV109QuRMrcYzq+uAw6uhzbo1uHBcktJIoA/BST+3iXgHBdn/IxNBUNfTkJBO6W/UxqPg XN9NFZiZwiei0fgqmBEfYVvo2KqC4priFv57t+R6RksUqzJ2CrnKa1QtT9XzMO0idcPEpP x9YK9dh0QPo+YEFS84ifkzaC1j2yY6BN0xg8iEoTTv7nIJ79YVxcAZaqPjnmjWZpZg0wDA BCbMEFzaioXZDI/CoV23em3wrYmc2OI5iCQw31B4rJ7Bkjpyz7HPWiaHJ7DNBHU5Z0MaNu IFn1Ya2Jb3gcTtKF9cRBONRE5FtrcaJi+wW7wZ8t/Uw5CSG0o8aztK+DxWX4dA== 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 4RlTv32hyKzfvX; Tue, 12 Sep 2023 16:44:15 +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 38CGiFQ3071208; Tue, 12 Sep 2023 16:44:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38CGiFeJ071205; Tue, 12 Sep 2023 16:44:15 GMT (envelope-from git) Date: Tue, 12 Sep 2023 16:44:15 GMT Message-Id: <202309121644.38CGiFeJ071205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 0f07f838d059 - releng/14.0 - linux(4): Return ENOTSUP from listxattr instead of EPERM 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 0f07f838d059a2b56c33cd6340f0a172e8d97af7 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0f07f838d059a2b56c33cd6340f0a172e8d97af7 commit 0f07f838d059a2b56c33cd6340f0a172e8d97af7 Author: Dmitry Chagin AuthorDate: 2023-09-05 08:52:27 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-12 16:43:10 +0000 linux(4): Return ENOTSUP from listxattr instead of EPERM FreeBSD does not permits manipulating extended attributes in the system namespace by unprivileged accounts, even if account has appropriate privileges to access filesystem object. In Linux the system namespace is used to preserve posix acls. Some Gnu coreutils binaries uses posix acls, eg, install, ls, cp. And fails if we unexpectedly return EPERM error from xattr system calls. In the other hands, in Linux read and write access to the system namespace depend on the policy implemented for each filesystem, so we'll mimics we're a filesystem that prohibits this for unpriveleged accounts. Approved by: re (gjb) Reported by: zirias Tested by: zirias MFC after: 1 week (cherry picked from commit 11e37048db35d7fcfc285b867965de1aeefec2c8) (cherry picked from commit e975d1b72507def7a699adf1cb38c68b48d80f51) --- sys/compat/linux/linux_xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c index 71d7ae58439e..6979fff9c82d 100644 --- a/sys/compat/linux/linux_xattr.c +++ b/sys/compat/linux/linux_xattr.c @@ -165,6 +165,8 @@ listxattr(struct thread *td, struct listxattr_args *args) error = kern_extattr_list_fd(td, args->fd, attrnamespace, &auio); rs = sz - auio.uio_resid; + if (error == EPERM) + break; if (error != 0 || rs == 0) continue; prefix = extattr_namespace_names[attrnamespace];