From nobody Tue Sep 05 08:53:54 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 4RfznZ4nDnz4sJGJ; Tue, 5 Sep 2023 08:53:54 +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 4RfznZ469bz3LLQ; Tue, 5 Sep 2023 08:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693904034; 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=ADadii1cul/gqOB50EUusNmZI8VTwYhx71G7yk88uKs=; b=Yd90OMfaGBSwWBvN9Fk+c0jd3QxjauCNR40KojdFuk1xllrw5QEhLc82xtkLsvzZ6vLDkG 66mur6TWG/H+Mm/NAWtZ1ymD6MjgvZXFVB3NZqmUiGua5djHJ4+8g3Upd5RkBt0r8f8/nb 8AW9HkWnhX8A9g/otxRUFDWW8ZEfQZEmmIAHaEVPRjjtPgJNCfsi5+AuiDpoHtSr2ifDtj WFk8pgeZVjvcsvmyNwP/eI06Cz4PmuDfLwX83javcdY6p6iK2LmMR1YO9V+hPzNEOfi/FZ dNypmSP0XuYDfXfRL4/CauqEPeJosiOOk7bzsdEhxpkEBPVoF7PJhoMUiV+13Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693904034; a=rsa-sha256; cv=none; b=I/cxBLJPUArX6MqzSIW8LNrk3l5ARyiX0LjV/gzpeWzbvG2f7df3j/fxlhvjqOpY+O+iRT Kl+tmHqNIVEr8J7enB+8+Far8KfuijrAvpGRbrsj76MR1Vaoa8f6b3z1Himau2ux4CVZMh xRLfirw8nq1XXECwi1NGzbL5G5NOFDlmyjm9SZU4W+rJ477COmQzJ3X9ZAUutoQivl4hJm 1kqnX6/iLSMQANMmr6o8YkG5QSvL86BNGgSUbTK4R4o9xi1lyvcU4dRdz4aUH5hOyto96/ BcjzxJbVtiOUYbdJtR6L3AQVBLFrkvgbfpjq+nLxizKLTmiHqGbJTs3VlbbHpg== 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=1693904034; 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=ADadii1cul/gqOB50EUusNmZI8VTwYhx71G7yk88uKs=; b=fdzPSGFvZW1PbchT6taF81ngaT1WiIFaWzDIu0Rik5CnwhgUySDUdRMEEyABaMMquVIMMj ipHu+RhhVMysUrDzinpu9bVFgwGObnvD0c9Nx7RnEDgAt9oNwj2LGihGRGnHhNbzh1WnxS YeL26rp3f6tNs4ZT7A8UXgBLjKJEw8zCIGthJTTcFz3aOG9S2J9QisJLd1/6W194RdFuke fp70e8OHfY+UnXXavUpsXJeY8+fySrbRyBI7UpOLGk1g6bISlPDaZY5WvUnoXz6wdJFUk6 i4d/76iW9kGuQCyEuMFAZTwkP3vW0DS2tvOEjT+y7TGun9w8yyrJJ1z508Imeg== 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 4RfznZ2pbhzBVx; Tue, 5 Sep 2023 08:53:54 +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 3858rsng030661; Tue, 5 Sep 2023 08:53:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3858rsGi030658; Tue, 5 Sep 2023 08:53:54 GMT (envelope-from git) Date: Tue, 5 Sep 2023 08:53:54 GMT Message-Id: <202309050853.3858rsGi030658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 11e37048db35 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 11e37048db35d7fcfc285b867965de1aeefec2c8 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=11e37048db35d7fcfc285b867965de1aeefec2c8 commit 11e37048db35d7fcfc285b867965de1aeefec2c8 Author: Dmitry Chagin AuthorDate: 2023-09-05 08:52:27 +0000 Commit: Dmitry Chagin CommitDate: 2023-09-05 08:52:27 +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 --- 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];