[<prev] [next>] [day] [month] [year] [list]
Message-ID: <45DB4201.3040108@redhat.com>
Date: Tue, 20 Feb 2007 13:46:25 -0500
From: Peter Staubach <staubach@...hat.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] memory mapped files not updating timestamps v2
Hi.
Attached are some changes to address the problem that modifications to
the contents of a file, made via an mmap'd region, do not cause the
modification time on the file to be updated. This lack can cause corruption
by allowing backup software to not detect files which should be backed up.
This also represents a potential security hole because it allows a file
to be
modified with no corresponding change in the file modification or change
time fields.
The changes add support to detect when the modification time needs to be
updated by placing a hook in __set_pages_dirty_buffers and
__set_pages_dirty_nobuffers. One of these two routines will be invoked
when the dirty bit is detected in the pte. The hook sets a new bit in the
address_space mapping struct indicating that the file which is associated
with that part of the address space needs to have its modification and
change time attributes updated.
The new bit described above is used in various system calls to cause the
modification and change times to be updated. These are the msync and fsync
system calls. Additionally, these two timestamps will be updated if a
sync or other inode flushing operation occurs as part of normal system
operations.
This support is updated from the previous version by adding support to
correctly update the timestamps on block special devices.
These changes were tested in two ways. One was to simply create a file,
write(2) to it, close it, and then test to ensure that the file modification
time does not change after the file is closed. Another was a program which
creates a file, mmap's it, modifies the mapped pages, and then either
msync's
the region, fsync's the file, sync's the system, abruptly exits, or simply
munmap's the files. This program shows the file mtime and ctime fields at
various times and these times were used to ensure that they did change and
did change in expected ways.
Thanx...
ps
Signed-off-by: Peter Staubach <staubach@...hat.com>
View attachment "mmap_mctime.devel.v2" of type "text/plain" (6014 bytes)
Powered by blists - more mailing lists