From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD25C4CECE for ; Wed, 18 Sep 2019 09:07:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38471218AF for ; Wed, 18 Sep 2019 09:07:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="kfWr8gWB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728427AbfIRJHh (ORCPT ); Wed, 18 Sep 2019 05:07:37 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55590 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728278AbfIRJHh (ORCPT ); Wed, 18 Sep 2019 05:07:37 -0400 Received: by mail-wm1-f66.google.com with SMTP id a6so1623583wma.5 for ; Wed, 18 Sep 2019 02:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6G/whdxwOVG2qxmcsy9XC+pDIIKNhBXnDvwIF4K/VBs=; b=kfWr8gWBYBcBGgcxeOud4gsGHHoCDZ+e2gVUoUqlrkYqpWgQKaJ78hHgXC3ilzVr0O +8pkEG8kqn4PpvoHDlJhIdgZOtD96xrMJPf5rxoAvthocW4621d3D9Qh5trYnLS5SZ1C BN08nY19kls8ugqtZhrEwO8LpHQ8mUyG2tZWI= 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=6G/whdxwOVG2qxmcsy9XC+pDIIKNhBXnDvwIF4K/VBs=; b=H6p9iWO11ld5v5o0cA1+YOPckUn0M6qWcoscALNELQWOCJQT4xxWNf8E1PNEnJIYQC YGWeXTfhpJYxVnENV7AuvsIxwb4yalNFBMe9Fkij9lqgC497viVUt+wKu/5+A8v6gklF kbZORSVT8lFLFkaFWGtj5+QfRp2kkELtp/niDTkXkTXg38vzQO/ozvX4gkon/fKqxIb5 XjtWbMYjjzfoEjbsSdo84ypYEJDyCWK4w9/GSuv9YnNrFF8eLfi98ljRO25VbbWSDCV3 qABCuXVVEk3FwCu42kg2Dc5A1uWN9EQGNsysKV3EXGzexoBN6AUcQeAtrTRumoTWQKWA gZ5w== X-Gm-Message-State: APjAAAUAP5P74LAHz/eAmImByMd0PSoNALyh3cOZnRpgh+uqZzp10JW2 7X9QZQsDECnUKdN2KuPUfutufQ== X-Google-Smtp-Source: APXvYqxcHp0ur5Smn0yHXP17FwVKc+WjZmFyaf7NbEJ/4W74qLgNfNcp6RlqK0gpGfLkmsfzOB/N8g== X-Received: by 2002:a7b:c1cc:: with SMTP id a12mr1816647wmj.73.1568797655318; Wed, 18 Sep 2019 02:07:35 -0700 (PDT) Received: from miu.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id q124sm2478546wma.5.2019.09.18.02.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 02:07:34 -0700 (PDT) Date: Wed, 18 Sep 2019 11:07:31 +0200 From: Miklos Szeredi To: "J. Bruce Fields" Cc: NeilBrown , Andreas Gruenbacher , Andreas =?utf-8?Q?Gr=C3=BCnbacher?= , Patrick Plagwitz , "linux-unionfs@vger.kernel.org" , Linux NFS list , Linux FS-devel Mailing List , Linux Kernel Mailing List , Thomas Lange Subject: Re: [PATCH] overlayfs: ignore empty NFSv4 ACLs in ext4 upperdir Message-ID: <20190918090731.GB19549@miu.piliscsaba.redhat.com> References: <266c571f-e4e2-7c61-5ee2-8ece0c2d06e9@web.de> <20161206185806.GC31197@fieldses.org> <87bm0l4nra.fsf@notabene.neil.brown.name> <20190503153531.GJ12608@fieldses.org> <87woj3157p.fsf@notabene.neil.brown.name> <20190510200941.GB5349@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510200941.GB5349@fieldses.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, May 10, 2019 at 04:09:41PM -0400, J. Bruce Fields wrote: > On Tue, May 07, 2019 at 10:24:58AM +1000, NeilBrown wrote: > > Interesting perspective .... though doesn't NFSv4 explicitly allow > > client-side ACL enforcement in the case of delegations? > > Not really. What you're probably thinking of is the single ACE that the > server can return on granting a delegation, that tells the client it can > skip the ACCESS check for users matching that ACE. It's unclear how > useful that is. It's currently unused by the Linux client and server. > > > Not sure how relevant that is.... > > > > It seems to me we have two options: > > 1/ declare the NFSv4 doesn't work as a lower layer for overlayfs and > > recommend people use NFSv3, or > > 2/ Modify overlayfs to work with NFSv4 by ignoring nfsv4 ACLs either > > 2a/ always - and ignore all other acls and probably all system. xattrs, > > or > > 2b/ based on a mount option that might be > > 2bi/ general "noacl" or might be > > 2bii/ explicit "noxattr=system.nfs4acl" > > > > I think that continuing to discuss the miniature of the options isn't > > going to help. No solution is perfect - we just need to clearly > > document the implications of whatever we come up with. > > > > I lean towards 2a, but I be happy with with any '2' and '1' won't kill > > me. > > I guess I'd also lean towards 2a. > > I don't think it applies to posix acls, as overlayfs is capable of > copying those up and evaluating them on its own. POSIX acls are evaluated and copied up. I guess same goes for "security.*" attributes, that are evaluated on MAC checks. I think it would be safe to ignore failure to copy up anything else. That seems a bit saner than just blacklisting nfs4_acl... Something like the following untested patch. Thanks, Miklos --- fs/overlayfs/copy_up.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -36,6 +36,13 @@ static int ovl_ccup_get(char *buf, const module_param_call(check_copy_up, ovl_ccup_set, ovl_ccup_get, NULL, 0644); MODULE_PARM_DESC(check_copy_up, "Obsolete; does nothing"); +static bool ovl_must_copy_xattr(const char *name) +{ + return !strcmp(name, XATTR_POSIX_ACL_ACCESS) || + !strcmp(name, XATTR_POSIX_ACL_DEFAULT) || + !strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); +} + int ovl_copy_xattr(struct dentry *old, struct dentry *new) { ssize_t list_size, size, value_size = 0; @@ -107,8 +114,13 @@ int ovl_copy_xattr(struct dentry *old, s continue; /* Discard */ } error = vfs_setxattr(new, name, value, size, 0); - if (error) - break; + if (error) { + if (ovl_must_copy_xattr(name)) + break; + + /* Ignore failure to copy unknown xattrs */ + error = 0; + } } kfree(value); out: