Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp735066pxu; Wed, 2 Dec 2020 01:51:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlAQtbqNQtWUtACvmabgX7zd+XgK7iHSuzOcwbTyjpUosztsxe8dgvQvZ+S0uzSrMxdlw0 X-Received: by 2002:a17:906:1b04:: with SMTP id o4mr1453359ejg.531.1606902682204; Wed, 02 Dec 2020 01:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902682; cv=none; d=google.com; s=arc-20160816; b=G5UgmcoHRFbW03JlrDN85ll3wy+lkqIUiTEo2FsJWYJuVgc/JusP0i+JDknOymtLDd 26zpXbpb91/LDjfzlDEMKSFbIC6A+H8CR1XkfbJeIl0G+QzoMFs2CZgpNPfkmWPs/h4h bWE2TSqlTBNDd63xBF2zr8bsJ/18+ErsAiu/GMRQA+cgSIQM3dNvzO2srAL3wfRYF93B zC6rHe7UjwLsjLa0RPg/VREOfhB4Z+JKxCMuyCerquz5Tt4rJi9pt9tj+NQG1BYBZyrt 2+2GVjv87lb834uled+Edkm70YShXbWmpZ7B7+KALlhP2YvArxYRLANQZNlQWpLk4ono VMwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=OHCotL5GQsPpQJjgh4n2MaKXr6FIEVLC71R/388P2zg=; b=n2zT4Lxr5lU1Fi3gw5pca/DycIU837AkpJPSz26VAcyLwlSelvLfUe0cALGAw/FY2M oEeGFoCmqeH499saEvxKqjamFqfy2LdsG6JouixaXShiBW05LhtCDdz/AfnVuNIvZV/c go7fZ9m0WGjYHCvaTJdh3FXAGVFvDN/bnNJ+hCpbEId3tvFUocKg974WVByCt/GCYNTm r/5vZHfZ/7AEXLZapn0gPtGESLK3gbcrrli9lUjEPVEpIlVh3B7fa6YjorlfYCT5XNEa mTilvSnBlAaq6WNO6LloT58YygIqeKO6Zy1WLLPJMARBk0jJHO5blArON4//NR7bLQu2 AaUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 n9si773228edi.179.2020.12.02.01.50.57; Wed, 02 Dec 2020 01:51:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388202AbgLBJsj (ORCPT + 99 others); Wed, 2 Dec 2020 04:48:39 -0500 Received: from verein.lst.de ([213.95.11.211]:53259 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387847AbgLBJsi (ORCPT ); Wed, 2 Dec 2020 04:48:38 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 2480068AFE; Wed, 2 Dec 2020 10:47:52 +0100 (CET) Date: Wed, 2 Dec 2020 10:47:51 +0100 From: Christoph Hellwig To: Christian Brauner Cc: Christoph Hellwig , Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Seth Forshee , =?iso-8859-1?Q?St=E9phane?= Graber , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Paul Moore , Jonathan Corbet , containers@lists.linux-foundation.org, fstests@vger.kernel.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org Subject: Re: [PATCH v3 04/38] fs: add mount_setattr() Message-ID: <20201202094751.GA6129@lst.de> References: <20201128213527.2669807-1-christian.brauner@ubuntu.com> <20201128213527.2669807-5-christian.brauner@ubuntu.com> <20201201104907.GD27730@lst.de> <20201202094218.ym5zqnulwz6gj6eo@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201202094218.ym5zqnulwz6gj6eo@wittgenstein> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Dec 02, 2020 at 10:42:18AM +0100, Christian Brauner wrote: > > > + if (upper_32_bits(attr->attr_set)) > > > + return -EINVAL; > > > + if (build_attr_flags(lower_32_bits(attr->attr_set), &kattr->attr_set)) > > > + return -EINVAL; > > > + > > > + if (upper_32_bits(attr->attr_clr)) > > > + return -EINVAL; > > > + if (build_attr_flags(lower_32_bits(attr->attr_clr), &kattr->attr_clr)) > > > + return -EINVAL; > > > > What is so magic about the upper and lower 32 bits? > > Nothing apart from the fact that they arent't currently valid. I can > think about reworking these lines. Or do you already have a preferred > way of doing this in mind? Just turn the attr_flags argument to build_attr_flags into a u64 and the first sanity check there will catch all invalid flags, no matter where they are places. That should also generate more efficient code.