Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3405226pxf; Mon, 22 Mar 2021 05:50:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZWYzTqYaBF9kcCby6kg6rXcJ1LYh9eELT4LDqjaFjKwx8Ncs59KipBeBjMIjnSuOtEc4B X-Received: by 2002:a17:906:27c7:: with SMTP id k7mr19330735ejc.13.1616417406799; Mon, 22 Mar 2021 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616417406; cv=none; d=google.com; s=arc-20160816; b=JeQepYeSVemJbIe4rVQkkU+PIs02CqHttVm8zF6rMlUMF7z8PSwYlKFKpPBGTBEmtc ug3Jk6SF6eE12Z1ZpZ2xKBKJxGTWB2vB+tAqG4GtTL0gPEP8TgSYRpkGMT9BJjnTumcA eAIKaSPKuIwihVbSCzO4xth4eZs5rJPVFOkPAIJjzoQbuSW9qI/Jtt4sAR/UBcWbh450 jkLeGVQxz6Hv/o0FDEwigKFe4PYh0UXJml2Zepbg6EiKpK2MOZQVRZoinBggnvj9fPzW H+xVxIF3kl844CQUO5TW2zvVGpjXHdLumoz5HmlPpGDdg6KQ704D0va5SBM4G+9UfqwI Upqg== 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=Etuskux5r2x9q8Cc/cBCzYOw5QpoiK8j6V6LnmKdFC6MxSZ/ew+aA60BZpiPAnwqQn MhY/K4PixZtexiPm5WIql4e2qIqUgH8N+RKoBp6CKM7vbAEos3oie4SzcsRXK83I1796 tcVSIwQY9gqYwjg8Lphsbmddu0i2zreZe1XXWZEDcsH3U9cQaky4+KG8SqNlk2ilxn9z 1Twv1YlQT7+6PPX3gQrzKkHeUFN2Iz2xy4QE8lKHOJFFJfm60Zvj+ipXZiL3SnFdshPH g0YWq1SoJcHq16FpJI7v8NOZ/0VjTPg8mjgwq1BgeDzc3RpiO0J420R7FMgsYbuaOGnj /srA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pwrMBzmK; 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 ec10si10970090ejb.386.2021.03.22.05.49.43; Mon, 22 Mar 2021 05:50:06 -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=pwrMBzmK; 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 S230134AbhCVMpx (ORCPT + 99 others); Mon, 22 Mar 2021 08:45:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbhCVMiZ (ORCPT ); Mon, 22 Mar 2021 08:38:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7EDF619B3; Mon, 22 Mar 2021 12:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416654; bh=1ylKi/Lb+2JkUHWnkoK3imsOcMQ9ujRfr+jFa2LfkeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwrMBzmKrzwyllCm/Fe+aw7f+zqHosv7UKc2H3C5EyF1o7mSwUsE566y9PdMxBpnb 9V0mPmZo21JlMe50G9TS3RGnrbLZa1x4TtXNHqEX4Oo5tP341R3byvbUIE4veKChiB QFEIDHyTeEFkgThZxhWNmZ5obAYwFzg8QwMwS0V4= 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.10 034/157] afs: Stop listxattr() from listing "afs.*" attributes Date: Mon, 22 Mar 2021 13:26:31 +0100 Message-Id: <20210322121934.842515669@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121933.746237845@linuxfoundation.org> References: <20210322121933.746237845@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. */