Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3149917rdb; Tue, 29 Aug 2023 06:55:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3y9pc2BEX7rkz2Hl0C3An/XsdTmxIYkGBkB3Zb15LITfWpYA3bxbSfgJmt45BD4rR0hqE X-Received: by 2002:a9d:7d13:0:b0:6bf:f75:1ad6 with SMTP id v19-20020a9d7d13000000b006bf0f751ad6mr7454285otn.26.1693317343251; Tue, 29 Aug 2023 06:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693317343; cv=none; d=google.com; s=arc-20160816; b=dHYjvnwaiwpqyTg8wAY3/WGXc1Nj0j/VrXFvlzaHqpKV9OUofF6PZKafDU6NwOyMCK yBC/vvPgCYWm34IHIodsSBaa5mRWBY1elOZAT8JipuzIlxHSiNSfqJf4d/Et8xXOWZQl Ctu5RwroKL/kPX85gEmbUx4qqqO/elMDtYUtIOfePkzCNXaJYmr9ebf3ql/Zvi2mespj l/p9h1bc2Hq8o5Bvmre03ljyQxhDCvXmBJapC0swHORvNn4Lv2D2JIorzdQFq1z2mlve owp22n+4lguPwTcErLctSet7UQYRjvCOuevb2uZlKo8V94zQsHJTwlLFCFDVBgeGWVmt xqvg== 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=KCKLsw2luDg+ufhtBmnGZmmgDMOsylBVvKdrvYUCWaY=; fh=sYz6vTloa5y4t5D2n2vyFywc3p/Jm9dtt9igFkP5puM=; b=ZKFVElJ+eZSr3i9UUCdmLlihZgZY54N6xL6TuZ/vFlsf70sA3ls6n36ecDgnDXqvWI T71h98xj7LrkStuH5KbZWYZzQzcUmD96h9kVdNz0YE7qeQmSyixMk9KMakWRoJFQ2CA6 Sb6AI3CL0RaLAtOXrWS03Twp5G+QhLtDYVbKXTTmqnWv/ePGeZMryq9JbLLdVtbFv5nM IXg/E6Q0InCT6aFPTBaGhYLvCcrkXwCtQBgXMEaTng9jI2jFjx4NHlV1Z7gxOqWeWr1V oT9VRcH3ge0+EFeg+ZqOxCJZGlGSiC4idF9lRxfrF9zyjjBJKDFduruuVqG5Sb0i0AqG EotA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r26-20020a638f5a000000b005641ddd0309si9170091pgn.599.2023.08.29.06.55.23; Tue, 29 Aug 2023 06:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234739AbjH2ND4 (ORCPT + 99 others); Tue, 29 Aug 2023 09:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235899AbjH2NDp (ORCPT ); Tue, 29 Aug 2023 09:03:45 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B4FCED; Tue, 29 Aug 2023 06:03:31 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 93D3A6732D; Tue, 29 Aug 2023 15:03:27 +0200 (CEST) Date: Tue, 29 Aug 2023 15:03:27 +0200 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , Jens Axboe , "Darrick J. Wong" , Andrew Morton , Matthew Wilcox , Christian Brauner , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] block: open code __generic_file_write_iter for blkdev writes Message-ID: <20230829130327.GA26482@lst.de> References: <20230801172201.1923299-1-hch@lst.de> <20230801172201.1923299-4-hch@lst.de> <20230829020614.GB325446@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230829020614.GB325446@ZenIV> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 29, 2023 at 03:06:14AM +0100, Al Viro wrote: > On Tue, Aug 01, 2023 at 07:21:58PM +0200, Christoph Hellwig wrote: > > @@ -569,7 +594,23 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) > > iov_iter_truncate(from, size); > > } > > > > - ret = __generic_file_write_iter(iocb, from); > > + ret = file_remove_privs(file); > > + if (ret) > > + return ret; > > That chunk is a bit of a WTF generator... Thankfully, > > static int __file_remove_privs(struct file *file, unsigned int flags) > { > struct dentry *dentry = file_dentry(file); > struct inode *inode = file_inode(file); > int error = 0; > int kill; > > if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode)) > return 0; > > means that it's really a no-op. But I'd still suggest > removing it, just to reduce the amount of head-scratching > for people who'll be reading that code later... I'll send an incremental patch to remove it once the changes hit Linus' tree.