From nobody Mon Sep 11 12:00:19 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 4Rkldv6S6wz4stsK; Mon, 11 Sep 2023 12:00:19 +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 4Rkldv5qXFz3Qhd; Mon, 11 Sep 2023 12:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694433619; 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=s76PCtNkuZYDRnTcf7579S+mY2+nKVY9psE1+tF/0hk=; b=Qg00NCXj+jySzHdKTA254KuwUmGe+SvWEsl2+pTtoiFBFCl+C3zBeFrPtdtRwE9Y4lKHpQ 1GqY3plRQSv/RX747lQ/3m5wiF8Ti3pI80tnV0sGB4lqwywvLrjsaXYiGA2fUaeG4m0kx+ nMlYnHdJjhSsmvasWoH3RVZ5gi85uP/CfEtSIdduAlTc/+PB89DEf86bFxaAiyG0CDnCUu HM7j8v79juvBHJYFve4ajwyDRw/+cODft65oqZImtJfSG3luWa6ScIEDtlK9zG6uA0Z5pM Uhcu0uMNywQcn3OMhcJfuTq4T8Z243ELbCK5/yBW/9VHY8XPI+EX+zCs4dHKDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694433619; a=rsa-sha256; cv=none; b=WvjNbBRawm0aD35DhHN5rcF3pxjrX5CcHyCyklz6a/R+vjfKvnM0IXtwQs3epykiTV7sF4 txnoRDTfb/zoYj2ba1r9w4zbSOPHfRpZ1HBCG0A+vRS+PQEJSSqqsmwQdQR0kDZjHZ9pO6 w7AgWDlFTSxJ0JpwMAdDC4dtSFrjFdr7yOFajTfFNYI3W/g6zsWr4L1KRdFtHFrxb99KaY 72ZfsMlWJXV7YasdFXQ4XD1CX1ZMasnd40JgHTVGuq6zBP/5G+ujRS//6/FdQQcP/c5XYh 58ySyrnJjFPBvOFINBAEfmJPd+XMosz+L63SuBgFRCoeSxc9PTE3DuXBAlQEbA== 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=1694433619; 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=s76PCtNkuZYDRnTcf7579S+mY2+nKVY9psE1+tF/0hk=; b=d+XRdIm5l0n5WdVFWAAccCOd2lUXEItTNVbpy01/kubGn2tnNRlL30kKkYZHi9fEYSfEwl anZRmvGe3+X9d/OMNjx7TjSx5/l+dBp0U82NW7Su4yp0p8qsRA8jbLrpiMZPDX0vxNhkdd ooloNNSjnYRR7DTbVHr+uzxaY94l06Qv2sCWtIN2Y4BPETPToJn5/02c+A0N7o1f5Wyj5T GgP48LEAeUnIbnSU17+ozw0pCcutoIXJkD6jQWekKkhxfQQxhY93Fx7eVe+eCNYVn2vIYC xINc+yRkytQUjcONzQ2CxQdYVBpgVY58HsMQMqOs1SNQ9FShyLH9rJqZ+d+d+w== 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 4Rkldv4xHXznrg; Mon, 11 Sep 2023 12:00:19 +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 38BC0JNr001556; Mon, 11 Sep 2023 12:00:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38BC0J2s001553; Mon, 11 Sep 2023 12:00:19 GMT (envelope-from git) Date: Mon, 11 Sep 2023 12:00:19 GMT Message-Id: <202309111200.38BC0J2s001553@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: e975d1b72507 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: e975d1b72507def7a699adf1cb38c68b48d80f51 Auto-Submitted: auto-generated The branch stable/14 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=e975d1b72507def7a699adf1cb38c68b48d80f51 commit e975d1b72507def7a699adf1cb38c68b48d80f51 Author: Dmitry Chagin AuthorDate: 2023-09-05 08:52:27 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-11 11:59:38 +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. Reported by: zirias Tested by: zirias MFC after: 1 week (cherry picked from commit 11e37048db35d7fcfc285b867965de1aeefec2c8) --- 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];