From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2DBEC433FE for ; Thu, 10 Mar 2022 04:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239472AbiCJEcO (ORCPT ); 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> 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