Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp584146pxj; Thu, 17 Jun 2021 09:11:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZE4XyDQiLqdY8/W0R0q2H3QHPXgC3nX9OzZBgD1h3HBQEetspkAAeNyGvejm0ly5A8bOS X-Received: by 2002:aa7:c256:: with SMTP id y22mr4111433edo.177.1623946267158; Thu, 17 Jun 2021 09:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623946267; cv=none; d=google.com; s=arc-20160816; b=JhhVywGEoBNDYEpkbGVm2Q8qqUEkynJKpT6GXq0tF5czcWv4nSisL1g2enuEeazoNT IBYN00ldpaEM5IrCjpnEyPGCDmEVmw19rHUgqjzxAVm3qy7cVQ9aEuUUP8wmdSdZTmSK GAQMag4rcQGlW9dmBGc3G/xmciOnvsA4RGUVjA+WhmKQguRGfPOBmhBc0vbfQeknlkhA Llti+CecQ6O6YSExlS3urLnTf7ILP88TuU4MmX+yDbaHQP0bK8AZaH85pnn10/bVc+hj GnJqlvTLrK3Goo7Tz8KfbHs6VnMuUoivOtaETA+VEsItQBJsrYIYtUWIQBEObFhOt+pZ kpSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=W5hiIU/behWS8FKO29w+io6DBLqOfDtyZdfD5zHIeYY=; b=bJ7D7NkqZzy1DuKdI6odmSGSw3189jLOdtS98EPBubUZDKSfc5Z6c4xDzhbcOZJPpU HD8LLrszWQY3BUvOobzBSjFUXPDlrnTH5rL1RrQ7bwYbiLyn1uVC6VXM+KoD+LlVXIUq nsslBAEu+4c90M1r6/U34691vgHJ1wQggww6kpf/zRd3Yn02To821Q1LAVYkKbHBwp4y w1/fnb/5Yp+kQ/HiQ9Q9A+my4A41ZHv79cFKpCvvv6GIHD4LkJXDa8tEdxOL97u5sLkL WYsRyy3VAt7pPV87IUAQtjJMS/hjhMEaKAUmtFec3MtgpjRisC4X9Rq7mGjY2O1+nc8e Mi9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CWlH03yX; 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 dz12si5788310edb.23.2021.06.17.09.10.43; Thu, 17 Jun 2021 09:11:07 -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=CWlH03yX; 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 S232879AbhFQOh7 (ORCPT + 99 others); Thu, 17 Jun 2021 10:37:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46369 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232816AbhFQOhy (ORCPT ); Thu, 17 Jun 2021 10:37:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623940546; 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=W5hiIU/behWS8FKO29w+io6DBLqOfDtyZdfD5zHIeYY=; b=CWlH03yXy9nLGgJIs/dDIPuI3LOsnRVkKEZ4LBVqdBTo9Uvbq5mivKwOFJynrn26dunC52 b8plPZwbQlIt6jRX2JjHkc1HA/FnYumiv/OUghqtaIii+YowFrRyx5ipb5H6Eoh8bd0nMh QBkE43ewYgGaPujR/RA5iVdxiSSYsi8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-CxDKWIuoPiKXbBAbcfF4Iw-1; Thu, 17 Jun 2021 10:35:44 -0400 X-MC-Unique: CxDKWIuoPiKXbBAbcfF4Iw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 769ED1940921; Thu, 17 Jun 2021 14:35:43 +0000 (UTC) Received: from horse.redhat.com (ovpn-116-162.rdu2.redhat.com [10.10.116.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E0C75D9E3; Thu, 17 Jun 2021 14:35:32 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id BD103220BCF; Thu, 17 Jun 2021 10:35:31 -0400 (EDT) Date: Thu, 17 Jun 2021 10:35:31 -0400 From: Vivek Goyal To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, virtio-fs-list , Luis Henriques , "Dr. David Alan Gilbert" , Seth Forshee Subject: Re: [PATCH v2 0/2] fuse: Fix clearing SGID when access ACL is set Message-ID: <20210617143531.GB1142820@redhat.com> References: <20210325151823.572089-1-vgoyal@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 01:57:01PM +0200, Miklos Szeredi wrote: > On Thu, Mar 25, 2021 at 4:19 PM Vivek Goyal wrote: > > > > > > Hi, > > > > This is V2 of the patchset. Posted V1 here. > > > > https://lore.kernel.org/linux-fsdevel/20210319195547.427371-1-vgoyal@redhat.com/ > > > > Changes since V1: > > > > - Dropped the helper to determine if SGID should be cleared and open > > coded it instead. I will follow up on helper separately in a different > > patch series. There are few places already which open code this, so > > for now fuse can do the same. Atleast I can make progress on this > > and virtiofs can enable ACL support. > > > > Luis reported that xfstests generic/375 fails with virtiofs. Little > > debugging showed that when posix access acl is set that in some > > cases SGID needs to be cleared and that does not happen with virtiofs. > > > > Setting posix access acl can lead to mode change and it can also lead > > to clear of SGID. fuse relies on file server taking care of all > > the mode changes. But file server does not have enough information to > > determine whether SGID should be cleared or not. > > > > Hence this patch series add support to send a flag in SETXATTR message > > to tell server to clear SGID. > > Changed it to have a single extended structure for the request, which > is how this has always been handled in the fuse API. > > The ABI is unchanged, but you'll need to update the userspace part > according to the API change. Otherwise looks good. Hi Miklos, I started looking at ACL patches for virtiofsd again. And realized that this SETXATTR_EXT patch, changes API. So if I update kernel headers and recompile virtiofsd, setxattr is broken. # setfattr -n "user.foo" -v "bar" foo.txt setfattr: foo.txt: Numerical result out of range I can fix it using following patch. But I am little concerned that all the users of fuse will have to apply similar patch if they update kernel headers (including libfuse) and recompile their app. Is that a concern, or should we rework this so that kernel header update does not break users. Thanks Vivek --- tools/virtiofsd/fuse_common.h | 5 +++++ tools/virtiofsd/fuse_lowlevel.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) Index: rhvgoyal-qemu/tools/virtiofsd/fuse_lowlevel.c =================================================================== --- rhvgoyal-qemu.orig/tools/virtiofsd/fuse_lowlevel.c 2021-06-16 17:39:16.387405071 -0400 +++ rhvgoyal-qemu/tools/virtiofsd/fuse_lowlevel.c 2021-06-17 10:22:04.879150980 -0400 @@ -1419,8 +1419,13 @@ static void do_setxattr(fuse_req_t req, struct fuse_setxattr_in *arg; const char *name; const char *value; + bool setxattr_ext = req->se->conn.want & FUSE_CAP_SETXATTR_EXT; + + if (setxattr_ext) + arg = fuse_mbuf_iter_advance(iter, sizeof(*arg)); + else + arg = fuse_mbuf_iter_advance(iter, FUSE_COMPAT_SETXATTR_IN_SIZE); - arg = fuse_mbuf_iter_advance(iter, sizeof(*arg)); name = fuse_mbuf_iter_advance_str(iter); if (!arg || !name) { fuse_reply_err(req, EINVAL); Index: rhvgoyal-qemu/tools/virtiofsd/fuse_common.h =================================================================== --- rhvgoyal-qemu.orig/tools/virtiofsd/fuse_common.h 2021-06-16 17:39:16.387405071 -0400 +++ rhvgoyal-qemu/tools/virtiofsd/fuse_common.h 2021-06-17 10:24:20.905937326 -0400 @@ -373,6 +373,11 @@ struct fuse_file_info { #define FUSE_CAP_HANDLE_KILLPRIV_V2 (1 << 28) /** + * Indicates that file server supports extended struct fuse_setxattr_in + */ +#define FUSE_CAP_SETXATTR_EXT (1 << 29) + +/** * Ioctl flags * * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine