Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1937043pxp; Thu, 10 Mar 2022 15:30:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCT7ZKvaEGjSBzlpqYqFFDJ4fSzI9+fO+GaEzzWp4iURMbXOjdbKh5oTWVTlfYYQKtdAMW X-Received: by 2002:a05:6402:2786:b0:416:6afe:2573 with SMTP id b6-20020a056402278600b004166afe2573mr6651976ede.54.1646955013546; Thu, 10 Mar 2022 15:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646955013; cv=none; d=google.com; s=arc-20160816; b=Rd8xheegt4xaHmr7QcxACyPhlkOli93NK+IsRQHqFOBmhW/FhRsAKOjFLAGgNoHEnC FVTB0lf0Snn1jYyXFK7g+gd9MiGWTj8tjhh0ii4Wt1n21j+ECcaED7O/eYUxSr+/xw3Y Q1Vni8b065XaMFgZZwsKpcUvTbTv8kFBUOmm4SjcvzTd3IlkDQvlwQxKkAK3DrhiPGvi /GgNbSYLfb4KEcqcK7CzK8F2EzpbFRJkck6gfABQIVJ7lYpRMM+3jVOfi1N1TTVyJv+6 43nvBhoh3fIhJUH6m7RWdq5SAGL/+hl2hghKloWSZmNbuptjeMgt9f9fNiYgzq/YUO8V 2DaA== 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=iosj4XBw0v5V8v0YGGCv+TNO3kC7Yi3lBrxg5pkKlA0=; b=hIzLGEqF2sOHRmKEy86TfH47ilKQqh8rNhi7++XVmelxrFWDw5TxmUpetAZ/ZrqvME 2az5ExwH+2XkIofZwSWLOOv43dRVoNbC+o4sykiy2fcguH+NnGgrMJZFRURjlFuC124F Evoy3pnONh4WqlTh7+v5Czv/hhH0zqskm+Gsq8hNEFTBUwZrk60mJ1ZuP2tDo37+iGNQ /0dwSvAXMp+DJDAa2zuxOyXkwtwIFh1rXwm9JKWy/ESn9aN/frtKLK+HO7Y76dekEZMo ErBtPpjCTBo9xpjMfFq0LxYTJeNPzFMmTK7H1mp/YOaHpYlG2s0NIr7CYaOWCe7lM00I ggvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Zf/jc2Ya"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402358900b0041663bfeb62si4350978edc.581.2022.03.10.15.29.48; Thu, 10 Mar 2022 15:30:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Zf/jc2Ya"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234164AbiCJRoO (ORCPT + 99 others); Thu, 10 Mar 2022 12:44:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241255AbiCJRoO (ORCPT ); Thu, 10 Mar 2022 12:44:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E041112F15C for ; Thu, 10 Mar 2022 09:43:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BA3A61E13 for ; Thu, 10 Mar 2022 17:43:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE81EC340E8; Thu, 10 Mar 2022 17:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646934191; bh=J11v0dZeoP8U3TqF3q8W8uMR8kA08ukr8hKbjh+FU/M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zf/jc2YaKbq/w+lgG82k+lqb5sfF8SKltTP2lEB6ZynaSeV1I4Frp+4qMlQhwSyKg QBmYbeVRuCwUzaP7tCQU+KEncaox2f1KeWLFvREBX7dBHOZEIyX2BM7TI7teGJ4wdo CDTL5pGYtnvv6ev4R7HZ1KRXCeRY2fzRUhz0EAHv1ShF5I57L/r4PI2Zglm1jfLAqw w0WiJkPrggwnpnUXd/k2/Wd8CZiGp5Y5BiIA1S8EyJlrVZcmQD3BnAqXUExKKpNENt uUDXbBRYGt34cUiS1kMO5yJD8ul62fzMo3uV22Cmedy0UrfY+sIinzr18bTzol9ehQ 4MRrfmoa3TMcA== Date: Thu, 10 Mar 2022 09:43:11 -0800 From: "Darrick J. Wong" To: Eric Biggers Cc: Theodore Ts'o , linux-ext4 Subject: Re: [PATCH] ext4: fix fallocate to use file_modified to update permissions consistently Message-ID: <20220310174311.GA8172@magnolia> References: <20220308185043.GA117678@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org On Wed, Mar 09, 2022 at 08:31:09PM -0800, Eric Biggers wrote: > On Tue, Mar 08, 2022 at 10:50:43AM -0800, Darrick J. Wong wrote: > > From: Darrick J. Wong > > > > Since the initial introduction of (posix) fallocate back at the turn of > > the century, it has been possible to use this syscall to change the > > user-visible contents of files. This can happen by extending the file > > size during a preallocation, or through any of the newer modes (punch, > > zero, collapse, insert range). Because the call can be used to change > > file contents, we should treat it like we do any other modification to a > > file -- update the mtime, and drop set[ug]id privileges/capabilities. > > > > The VFS function file_modified() does all this for us if pass it a > > locked inode, so let's make fallocate drop permissions correctly. > > > > Signed-off-by: Darrick J. Wong > > --- > > fs/ext4/ext4.h | 2 +- > > fs/ext4/extents.c | 32 +++++++++++++++++++++++++------- > > fs/ext4/inode.c | 7 ++++++- > > 3 files changed, 32 insertions(+), 9 deletions(-) > > Is there a test in xfstests that tests for this? Not currently. I /do/ actually have one drafted (which I'll email out as a reply) but I was gonna tackle fixing btrfs before I actually submit it to Eryu for upstream fstests. --D > - Eric