From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ipmailnode02.adl6.internode.on.net ([150.101.137.148]:19758 "EHLO ipmailnode02.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbdJBDyY (ORCPT ); Sun, 1 Oct 2017 23:54:24 -0400 Date: Mon, 2 Oct 2017 14:54:19 +1100 From: Dave Chinner To: Linus Torvalds Cc: Mimi Zohar , "Eric W. Biederman" , LSM List , linux-fsdevel , Christoph Hellwig , Theodore Ts'o , Jan Kara , Linux Kernel Mailing List , linux-integrity@vger.kernel.org Subject: Re: [RFC PATCH 3/3] fs: detect that the i_rwsem has already been taken exclusively Message-ID: <20171002035419.GH15067@dastard> References: <1506643967.5691.46.camel@linux.vnet.ibm.com> <1506649980.5691.100.camel@linux.vnet.ibm.com> <87mv5blki7.fsf@xmission.com> <1506859691.5691.211.camel@linux.vnet.ibm.com> <20171001223402.GG15067@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Sender: linux-integrity-owner@vger.kernel.org List-ID: On Sun, Oct 01, 2017 at 04:15:07PM -0700, Linus Torvalds wrote: > On Sun, Oct 1, 2017 at 3:34 PM, Dave Chinner wrote: > > > > We already have a change counter on the inode, which is modified on > > any data or metadata write (i_version) under filesystem locks. The > > i_version counter has well defined semantics - it's required by > > NFSv4 to increment on any metadata or data change - so we should be > > able to rely on it's behaviour to implement IMA as well. > > I actually think i_version has exactly the wrong semantics. > > Afaik, it doesn't actually version the file _data_ at all, it only > versions "inode itself changed". No, the NFSv4 change attribute must change if either data or metadata on the inode is changed, and be consistent and persistent across server crashes. For data updates, they piggy back on mtime updates .... > But I might have missed something obvious. The updates are hidden in > some odd places sometimes. ... which are in file_update_time(). Hence every data write or write page fault will call file_update_time() and trigger an i_version increment, even if the mtime doesn't change. Cheers, Dave. -- Dave Chinner david@fromorbit.com