Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3396554pxf; Mon, 22 Mar 2021 05:36:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxAw/slkHN8RF8Ee2ztxCom496wi24LCGKHZbWxPCNZTbYv6V/ewiMwR9Z7XoP1sxsP0Fn X-Received: by 2002:a17:906:8593:: with SMTP id v19mr19036573ejx.32.1616416593977; Mon, 22 Mar 2021 05:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616416593; cv=none; d=google.com; s=arc-20160816; b=ugcRM3Vq4X6mvI2unGr52+1RAFOiRZdMHpcw8S+M7N1f7n5dTqKNWIIi/mCY1rhX0l 0WY0NvfoIALXNYrYoTBj7P9vSTcMcgRXo+/2tlHA87SOJ/AnklbhynIUVf/Z9XodUkqO 9fCtg9zRP1S0oT8r8Al/Fd6GO4IZ9hffvd1ImfxEos+pVUKDDCTISHn8fhaZxFoxWZc6 nLuxE5YZST1RwbXytEuoqK957kzL6t0RHkayzMVmYxw+Txu8bh8tAbroM0y1W7nXGhXI IrBY7ZxW4HkTOhhVV+WqDBW8AgFTqID8ltUw6UNaI8rUb4M2AHxXJIeLFltBX4o4ToDs sjHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3Ln+Q1n9G7Tw74TDV/YCpL7eX0N1iFHk3l7xSNc6bJY=; b=B8EF1vwngQFnmx9AU/1018XWOhHpcPXXtWC7ibHJSzpepIncr+HjhfhkrVvWlOx028 g7rnkbnXbR6WysMLOXAoBOGNQ2fdaHETti5z+UvhAArEkgjoatINxkZukhuAzSN2O7nO R3sSBpHHfcRXk0fBeYZFFJ+QeT1vDNj78dNUEzf1LgybOKKdHNMjnTMfHDG1gULcBHed KrXB4cmgcp0Jnfz+rqgQmLmDQLY5EpcqH+1kGbF/7az2SVhpYQUQvMVFxdS/oJRnB8Px 6LwT5BanSzOryfNTXbu2QLyh0TabsC5Nr8syQK9pt8PHqcpFTrQoalCyHldsYZQ/3xJ7 ytkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kJXkUpZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si10753809edv.168.2021.03.22.05.36.11; Mon, 22 Mar 2021 05:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kJXkUpZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbhCVMfM (ORCPT + 99 others); Mon, 22 Mar 2021 08:35:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbhCVMce (ORCPT ); Mon, 22 Mar 2021 08:32:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFF8E619A7; Mon, 22 Mar 2021 12:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416353; bh=1ylKi/Lb+2JkUHWnkoK3imsOcMQ9ujRfr+jFa2LfkeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJXkUpZn0NSuLnN4fPzRT1vnf8oEI/HxHbEWN0fxEZCnCAdvOHb7J8/A7CKsQNn91 E0b7F2Bk5W6V8AtxrNT6rn2JV8Xx1nRsexsOc902A45Tuz8wlKXeKBBIsncKQhbELI JZAU7QaJd44y5pVVjqmjnJ9vBC0ULBjudVcnO7Us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaja Sophie Peters , David Howells , Jeffrey Altman , Marc Dionne , linux-afs@lists.infradead.org Subject: [PATCH 5.11 039/120] afs: Stop listxattr() from listing "afs.*" attributes Date: Mon, 22 Mar 2021 13:27:02 +0100 Message-Id: <20210322121930.962469662@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121929.669628946@linuxfoundation.org> References: <20210322121929.669628946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells commit a7889c6320b9200e3fe415238f546db677310fa9 upstream. afs_listxattr() lists all the available special afs xattrs (i.e. those in the "afs.*" space), no matter what type of server we're dealing with. But OpenAFS servers, for example, cannot deal with some of the extra-capable attributes that AuriStor (YFS) servers provide. Unfortunately, the presence of the afs.yfs.* attributes causes errors[1] for anything that tries to read them if the server is of the wrong type. Fix the problem by removing afs_listxattr() so that none of the special xattrs are listed (AFS doesn't support xattrs). It does mean, however, that getfattr won't list them, though they can still be accessed with getxattr() and setxattr(). This can be tested with something like: getfattr -d -m ".*" /afs/example.com/path/to/file With this change, none of the afs.* attributes should be visible. Changes: ver #2: - Hide all of the afs.* xattrs, not just the ACL ones. Fixes: ae46578b963f ("afs: Get YFS ACLs and information through xattrs") Reported-by: Gaja Sophie Peters Signed-off-by: David Howells Tested-by: Gaja Sophie Peters Reviewed-by: Jeffrey Altman Reviewed-by: Marc Dionne cc: linux-afs@lists.infradead.org Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003502.html [1] Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003567.html # v1 Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003573.html # v2 Signed-off-by: Greg Kroah-Hartman --- fs/afs/dir.c | 1 - fs/afs/file.c | 1 - fs/afs/inode.c | 1 - fs/afs/internal.h | 1 - fs/afs/mntpt.c | 1 - fs/afs/xattr.c | 23 ----------------------- 6 files changed, 28 deletions(-) --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -69,7 +69,6 @@ const struct inode_operations afs_dir_in .permission = afs_permission, .getattr = afs_getattr, .setattr = afs_setattr, - .listxattr = afs_listxattr, }; const struct address_space_operations afs_dir_aops = { --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -43,7 +43,6 @@ const struct inode_operations afs_file_i .getattr = afs_getattr, .setattr = afs_setattr, .permission = afs_permission, - .listxattr = afs_listxattr, }; const struct address_space_operations afs_fs_aops = { --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -27,7 +27,6 @@ static const struct inode_operations afs_symlink_inode_operations = { .get_link = page_get_link, - .listxattr = afs_listxattr, }; static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode) --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -1508,7 +1508,6 @@ extern int afs_launder_page(struct page * xattr.c */ extern const struct xattr_handler *afs_xattr_handlers[]; -extern ssize_t afs_listxattr(struct dentry *, char *, size_t); /* * yfsclient.c --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_ .lookup = afs_mntpt_lookup, .readlink = page_readlink, .getattr = afs_getattr, - .listxattr = afs_listxattr, }; const struct inode_operations afs_autocell_inode_operations = { --- a/fs/afs/xattr.c +++ b/fs/afs/xattr.c @@ -11,29 +11,6 @@ #include #include "internal.h" -static const char afs_xattr_list[] = - "afs.acl\0" - "afs.cell\0" - "afs.fid\0" - "afs.volume\0" - "afs.yfs.acl\0" - "afs.yfs.acl_inherited\0" - "afs.yfs.acl_num_cleaned\0" - "afs.yfs.vol_acl"; - -/* - * Retrieve a list of the supported xattrs. - */ -ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size) -{ - if (size == 0) - return sizeof(afs_xattr_list); - if (size < sizeof(afs_xattr_list)) - return -ERANGE; - memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list)); - return sizeof(afs_xattr_list); -} - /* * Deal with the result of a successful fetch ACL operation. */