Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3474427ybt; Tue, 23 Jun 2020 03:16:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+ga9T1TvWuPU2KudbPZxbNS8uNSkF+oJjIR/mArQVcm5SUDKSuwFsi1cKT9fBnQusj/Mh X-Received: by 2002:a17:907:100a:: with SMTP id ox10mr9824607ejb.351.1592907382033; Tue, 23 Jun 2020 03:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592907382; cv=none; d=google.com; s=arc-20160816; b=j9xW7zvmHWVJ5+lrQbCrbpwvIJIIzykLkPY8+IGxm4YpcxFhaTS4JtqKK67C0vTCVZ bnOmtUD9fW0NUVwoknmUHeRGDHaSBtEsVesuJUoiRv8FZAIIkX/HUuEsasxfUavC3iEv XjmA0HPLVmsORj2wAxf7YvuggCNLnvDpO6Pe1x8ApRqGn9f5Zd5PhDToTC/BPXRObPOJ 9LeYuREyXhBNBV9QwBFoAcXaGXfzbEu3L5Xwcs33rvFEla6l+f8i4LP3DwLqoty7Pkgc nf19Q9oSgQ4iW3LYBSAHh5FGbFAt3K0LuVdVSu+I5EOyPv1kWGbOvweBmPEIno7NiJRG VEjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=e9EXuJsowvJmInT502RC222CM0yXwh7m1JZTr0Jb8Os=; b=JBKO7I9altjA2cmvZMc3wOIJvQ8iX1hSA14VgetsoyEjtpkOF3A9kRdH0TjNiPOK88 uib6hRlVYWh5VhxFtqT70T9Bte8zJizbmDwZurKrsl2V33FEOvwoXlqGytyKjyedSxxo ii9iUlMvfsJu2vRCB1rd9nHKamKYNuKVo4YU2COGhYWJWcUFtsIiAOhJsOFCyNmNzY8T XhwHkm8de66nfMGMdv5rSITSnsgvaw4wUNFTVjEkT56o5lUVNA2LWUX5T8fyuXOkN3M3 YGANt4sJXYY1SxPUEHlOmGOKQ311y2IAAV75nYgi09ulL5ACGk4B2LU7cvithp+AsQ/p 6+Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hLPpC7r7; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si11645302ejs.546.2020.06.23.03.15.56; Tue, 23 Jun 2020 03:16:22 -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=@redhat.com header.s=mimecast20190719 header.b=hLPpC7r7; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732182AbgFWKK5 (ORCPT + 99 others); Tue, 23 Jun 2020 06:10:57 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42368 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732005AbgFWKK5 (ORCPT ); Tue, 23 Jun 2020 06:10:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592907055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=e9EXuJsowvJmInT502RC222CM0yXwh7m1JZTr0Jb8Os=; b=hLPpC7r7Ou1VcKAFREj0gshb1JOw4GsBBJy6tEqeZHt9w0PFJEfnpYH+yf0TijbZd5P7kk dtRdJyWXvMOTwdJ96KRWllWH+oZCpzRg+WbuB/7uL11RD+1aX9ufOey2bvxTtfK5A38R7T 3Zw+HeL2WtaLdIAMFW8wLDZBFIuUapQ= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-CxvkpNFoN0qiCGAEXQW3Aw-1; Tue, 23 Jun 2020 06:10:54 -0400 X-MC-Unique: CxvkpNFoN0qiCGAEXQW3Aw-1 Received: by mail-pg1-f199.google.com with SMTP id z187so12371710pgd.11 for ; Tue, 23 Jun 2020 03:10:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=e9EXuJsowvJmInT502RC222CM0yXwh7m1JZTr0Jb8Os=; b=GojlHqrx7YE/2rD4IQXaHBfXHEXE8gA+Ios0eFJHUWxSbP7NjMiVcqXyGkqYyFzXIt FdWml1hstrSQfJZeBwgTdZ5lpm87g79Jg0E4lhp7U69LdmzVsUgEFl5zGfA9wlCsRz0r 39LX9zJQQqSUVQ4feKEwU3Uxkpn4mrhiTZEoqmo+UjvzZSjiZ+Ik2E48i29A+sA1tj8M nDbRpd4/tvE29vNPprGqa/yZgLvRNio1Nd5C97cKxqE2FMHbVa6mdhHUELy/BMOrPXoP qqyCTJv7UGpdQjH+gflXsBTOuR5vdkSjynEa3udCHEXCP87I+UHSSzd+FfNhkw/nMsb5 gcGQ== X-Gm-Message-State: AOAM530X5aZfhrBe/kj4ayJ5Q9ayjufSyQN1qgpuRNNK+gh8OOexkNYk 1t/Kf46OCFCvtQha9AdfpYw5RM1sMR77kfqwVrIkmLg+TPqYCsLO9/JQgMwkK13XYs9pR5Je6z/ tFa5O9WMjV0tsjLwxzQqi9GG8 X-Received: by 2002:a62:770d:: with SMTP id s13mr25169547pfc.266.1592907053186; Tue, 23 Jun 2020 03:10:53 -0700 (PDT) X-Received: by 2002:a62:770d:: with SMTP id s13mr25169528pfc.266.1592907052957; Tue, 23 Jun 2020 03:10:52 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id a17sm1977991pjh.31.2020.06.23.03.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 03:10:52 -0700 (PDT) Date: Tue, 23 Jun 2020 18:10:42 +0800 From: Gao Xiang To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, LKML , Stephen Smalley , Chengguang Xu , Chao Yu Subject: Re: [PATCH] xattr: fix EOPNOTSUPP if fs and security xattrs disabled Message-ID: <20200623101042.GB1523@xiangao.remote.csb> References: <20200527044037.30414-1-hsiangkao@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200527044037.30414-1-hsiangkao@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Friendly ping... On Wed, May 27, 2020 at 12:40:37PM +0800, Gao Xiang wrote: > commit f549d6c18c0e ("[PATCH] Generic VFS fallback for security xattrs") > introduces a behavior change of listxattr path therefore listxattr(2) > won't report EOPNOTSUPP correctly if fs and security xattrs disabled. > However it was clearly recorded in manpage all the time. > > Cc: Alexander Viro > Cc: Stephen Smalley > Cc: Chengguang Xu > Cc: Chao Yu > Signed-off-by: Gao Xiang > --- > > Noticed when reviewing Chengguang's patch for erofs [1] (together > with ext2, f2fs). I'm not sure if it's the best approach but it > seems that security_inode_listsecurity() has other users and it > mainly focus on reporting these security xattrs... > > [1] https://lore.kernel.org/r/20200526090343.22794-1-cgxu519@mykernel.net > > Thanks, > Gao Xiang > > fs/xattr.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/fs/xattr.c b/fs/xattr.c > index 91608d9bfc6a..f339a67db521 100644 > --- a/fs/xattr.c > +++ b/fs/xattr.c > @@ -352,13 +352,15 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size) > error = security_inode_listxattr(dentry); > if (error) > return error; > - if (inode->i_op->listxattr && (inode->i_opflags & IOP_XATTR)) { > - error = inode->i_op->listxattr(dentry, list, size); > - } else { > - error = security_inode_listsecurity(inode, list, size); > - if (size && error > size) > - error = -ERANGE; > - } > + > + if (inode->i_op->listxattr && (inode->i_opflags & IOP_XATTR)) > + return inode->i_op->listxattr(dentry, list, size); > + > + if (!IS_ENABLED(CONFIG_SECURITY)) > + return -EOPNOTSUPP; > + error = security_inode_listsecurity(inode, list, size); > + if (size && error > size) > + error = -ERANGE; > return error; > } > EXPORT_SYMBOL_GPL(vfs_listxattr); > -- > 2.24.0 >