Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp756044pxf; Wed, 24 Mar 2021 15:25:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxStFbuY8u6vgb+I7EaUEjJg2w55G8yreDvwTvB3XJqiiKJ72RXx0UHLM/TkNfXuWZxRnmL X-Received: by 2002:a17:907:7014:: with SMTP id wr20mr6119550ejb.179.1616624748102; Wed, 24 Mar 2021 15:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616624748; cv=none; d=google.com; s=arc-20160816; b=x5ABTxayyxvnOvsrj3aZjX7UxLMhKYHcvHyZyxB55OzZrLywcyn/vMYuX8+70fM0tv KyW4GrJUIaKBpJvxs7tmIoQ8woKG9XuB2EFTBSHnwxeS4V6nE7xgYqFDffiywNT05wnf wSVMPqCsS2c4GQD4Zs+/4EpN4WqzLUCaeuJ7FwamAYIGnHZ4KZFtibdx65YL//v//VGb UGUCVwohJoA5DTEDXPMkHOxW+Hyw+1E7823XnslJnKES7dY6n6AKS9sUXAKYjQldn/56 xSNLNLqBdbSkWakQybZ4NZpUFI+5pb/+1hRZ5XMP/mvwLKKjTBxKvaSBPfmTFl3eMyoc k+1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=VCK4kFMLtOoxNnuGsuq7b3Se2xFEqZZYaFK5itufJAo=; b=ujWXTKQG7Fr/13twb7LG9G4uSNyB7mMTMbdP1Ywxff51C8IVOg14KDEc/WqgWNidNU G/2TEndJ3afFmpljBTrGG/lX/6V3N2Lkw08cZk/FilEWd5b4dhAxBXbeM8b+kILpEniG 1EqSAcE1wk9I/CPfaedTIhIBIHRyEEQhzxl/wz36+SFT58fbMqz4gRrGhZDGPuiYcP6A IsGELQY8YWFshCFzkh5uB6MW/HA2igDejU/vTriPj9zH8IVX4+rsniwQJ5iqi0aZtbTv 6fob/UlRNMbJ5GkAZ2gBCtxmX5OyX1pZAmhu3WxVsNu9vA9FPqteQbsxkp8NOABJ8Xo/ e2eg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si2799555edp.195.2021.03.24.15.25.24; Wed, 24 Mar 2021 15:25:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232884AbhCXFCa (ORCPT + 99 others); Wed, 24 Mar 2021 01:02:30 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:40672 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232648AbhCXFCN (ORCPT ); Wed, 24 Mar 2021 01:02:13 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOvel-008keX-JS; Wed, 24 Mar 2021 05:02:11 +0000 Date: Wed, 24 Mar 2021 05:02:11 +0000 From: Al Viro To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v2 01/18] vfs: add miscattr ops Message-ID: References: <20210322144916.137245-1-mszeredi@redhat.com> <20210322144916.137245-2-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322144916.137245-2-mszeredi@redhat.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 03:48:59PM +0100, Miklos Szeredi wrote: minor nit: copy_fsxattr_{to,from}_user() might be better. > +int fsxattr_copy_to_user(const struct miscattr *ma, struct fsxattr __user *ufa) > +{ > + struct fsxattr fa = { > + .fsx_xflags = ma->fsx_xflags, > + .fsx_extsize = ma->fsx_extsize, > + .fsx_nextents = ma->fsx_nextents, > + .fsx_projid = ma->fsx_projid, > + .fsx_cowextsize = ma->fsx_cowextsize, > + }; That wants a comment along the lines of "guaranteed to be gap-free", since otherwise you'd need memset() to avoid an infoleak. > +static int ioctl_getflags(struct file *file, void __user *argp) > +{ > + struct miscattr ma = { .flags_valid = true }; /* hint only */ > + unsigned int flags; > + int err; > + > + err = vfs_miscattr_get(file_dentry(file), &ma); Umm... Just to clarify - do we plan to have that ever called via ovl_real_ioctl()? IOW, is file_dentry() anything other than a way to spell ->f_path.dentry here? > +struct miscattr { > + u32 flags; /* flags (FS_IOC_GETFLAGS/FS_IOC_SETFLAGS) */ > + /* struct fsxattr: */ > + u32 fsx_xflags; /* xflags field value (get/set) */ > + u32 fsx_extsize; /* extsize field value (get/set)*/ > + u32 fsx_nextents; /* nextents field value (get) */ > + u32 fsx_projid; /* project identifier (get/set) */ > + u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ > + /* selectors: */ > + bool flags_valid:1; > + bool xattr_valid:1; > +}; OK as long as it stays kernel-only, but if we ever expose that to userland, we'd better remember to turn the last two into an u32 with explicit bitmasks.