summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkensmith <kensmith@FreeBSD.org>2005-05-31 19:39:52 +0000
committerkensmith <kensmith@FreeBSD.org>2005-05-31 19:39:52 +0000
commit3a7e275ce6fe687fad8627e57c54b3ffad200404 (patch)
treed75a1cb9a18bd7b666b9455b0fd7694b03243d9b /sys/ufs
parent89936cfe1297f8030a9804f08595408441727c36 (diff)
downloadFreeBSD-src-3a7e275ce6fe687fad8627e57c54b3ffad200404.zip
FreeBSD-src-3a7e275ce6fe687fad8627e57c54b3ffad200404.tar.gz
This patch addresses a standards violation issue. The standards say a
file's access time should be updated when it gets executed. A while ago the mechanism used to exec was changed to use a more mmap based mechanism and this behavior was broken as a side-effect of that. A new vnode flag is added that gets set when the file gets executed, and the VOP_SETATTR() vnode operation gets called. The underlying filesystem is expected to handle it based on its own semantics, some filesystems don't support access time at all. Those that do should handle it in a way that does not block, does not generate I/O if possible, etc. In particular vn_start_write() has not been called. The UFS code handles it the same way as it would normally handle the access time if a file was read - the IN_ACCESS flag gets set in the inode but no other action happens at this point. The actual time update will happen later during a sync (which handles all the necessary locking). Got me into this: cperciva Discussed with: a lot with bde, a little with kan Showed patches to: phk, jeffr, standards@, arch@ Minor discussion on: arch@
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_vnops.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 36dad08..720e7bb 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -443,6 +443,17 @@ ufs_setattr(ap)
((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
return (EINVAL);
}
+ /*
+ * Update the file's access time when it has been executed. We are
+ * doing this here to specifically avoid some of the checks done
+ * below -- this operation is done by request of the kernel and
+ * should bypass some security checks. Things like read-only
+ * checks get handled by other levels (e.g., ffs_update()).
+ */
+ if (vap->va_vaflags & VA_EXECVE_ATIME) {
+ ip->i_flag |= IN_ACCESS;
+ return (0);
+ }
if (vap->va_flags != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
OpenPOWER on IntegriCloud