Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1335177pxp; Thu, 10 Mar 2022 03:34:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3ya1vfu23X/5q0SMeYrjf66qMGiAmJm5el+iy0ODfnCbPj80OLXkXE702Up8qE2a3FcsM X-Received: by 2002:a17:906:c0c:b0:6ce:e59c:c38a with SMTP id s12-20020a1709060c0c00b006cee59cc38amr3771277ejf.483.1646912083012; Thu, 10 Mar 2022 03:34:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646912083; cv=none; d=google.com; s=arc-20160816; b=jqWx9H1ZnyWK8+A1iB/PhgvDn106wQvEZHuhxuFVJPnT0EdqTsHEfm41E7Gw3cV3WJ /FsKuMQPdp6k9DOQPdWUoHZ+zMlFiZ87VCDxy9kS2kwjxMC6+EagooHM/u6+XGNoa9zT GxgC0Es04blOraH3bt6GHtwmDBrG21NFUHAYiqKTdcrhfFedFUgV6NAdKRBEu8ulSYpV sIUKeM8eC06ZZEA+BdCY14mbopfaT0MdjGgO13FnM0QICf4dWB4INJdcD6dayOSjsyl7 WxnFWSNqKvplGbSfqgCoDMMHoe6H9HiAA+RHAd7w+ZEYaLoHd6FpB8UrtYvWxbh/lZNj ryqg== 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=7Qac7VVD+3mVi1DYwd14LCfM2GinazhFTjuikI0s4Ws=; b=CXGwvFEfj8TJa3BQLr8jEVzd+ueibHkg2728SbYXAvG/XHVoNJkSthERB4bDXRWG6b OQfA3/AIksblJ5A+aXmdT9unWD96FsIad0ekA8UNgNnqF92Le05B6BjCaONAI9Uacv6O 4yatZCTevSvoVlfFpNVK913GaPu3ms5Om6B0xaYcneMlerpcEGpUSI3MM+xSf2cYP9tN 4zHDSDROms8JOz6Vausc6eX9FeitYTcKYhen+4qsUWhDXd1VdNHCFiQV4lqN0quaRxZn PFmWly/+jf6bB6tM4cOyre1GyD4ldGLjnWTHuEqZGVAPrH4aQnoXxBnSY0XpL7GDtcnH d1dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nulpx7Nj; 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 i9-20020a0564020f0900b00416b95ab900si673411eda.87.2022.03.10.03.34.11; Thu, 10 Mar 2022 03:34:42 -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=nulpx7Nj; 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 S239468AbiCJEcO (ORCPT + 99 others); Wed, 9 Mar 2022 23:32:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239467AbiCJEcO (ORCPT ); Wed, 9 Mar 2022 23:32:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 029E812D09F for ; Wed, 9 Mar 2022 20:31:14 -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 ams.source.kernel.org (Postfix) with ESMTPS id B0B1FB8216C for ; Thu, 10 Mar 2022 04:31:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2765CC340E8; Thu, 10 Mar 2022 04:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646886671; bh=3Ii2Fa/P+lK3XJc01WeLDWVWit3uKbNd46Xro7cHO90=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nulpx7NjpFlg8KfT22thY3XIfCIOTvekKjF/6GGEQOD338zHrAxxk6CG7LxlxOqGS ehNmfdtsh6F0q9mN7MYusNePA+m172Iq1wv2cJ9cBkb5r9DKFre8F2JP6hmqdq/m2c XOD9Xkht6EWNIBegU0GbkFMnhJYrRxjUWIWgyp83mZW7JtckQaHqChzDRz494TAaVi pifnBzwTe3PQpMNBlppSNx+d3yT35TBAcDFS70gAObRAe+IzG+A2SqYNPtwzorgKCQ oVvGnqRVHrkp4ny2UvR5MuMnlReXVpGzwN3eCuu7u0zTbQfpCDRvrQARHAJkV9gcA5 9OLcXBLN+tjHw== Date: Wed, 9 Mar 2022 20:31:09 -0800 From: Eric Biggers To: "Darrick J. Wong" Cc: Theodore Ts'o , linux-ext4 Subject: Re: [PATCH] ext4: fix fallocate to use file_modified to update permissions consistently Message-ID: References: <20220308185043.GA117678@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220308185043.GA117678@magnolia> 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 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? - Eric