Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2001 18:02:48 +0000
From:      Phil Pennock <pdp@nl.demon.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/25777: atime not updated on exec
Message-ID:  <E14ct8C-0000B5-00@samhain.noc.nl.demon.net>

next in thread | raw e-mail | index | archive | help

>Number:         25777
>Category:       kern
>Synopsis:       atime not updated on exec
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 13 10:10:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Phil Pennock
>Release:        FreeBSD 3.5-STABLE i386
>Organization:
Demon Internet Netherlands
>Environment:
FreeBSD kernel.  Have checked CVSWeb, not seen sign of a fix.
Verified presence of bug on FreeBSD 4.2-STABLE.
>Description:
The atime attribute of a file should be updated on execve().
It's not.
>How-To-Repeat:
$ cp /usr/bin/true . ; touch -t 199901011234 true
$ ls -lu true ; ./true ; ls -lu true
>Fix:
This patch applies to my 3.5-STABLE system.

--- kern/kern_exec.c.old	Tue Mar 13 18:20:01 2001
+++ kern/kern_exec.c	Tue Mar 13 18:47:51 2001
@@ -64,6 +64,10 @@
 
 #include <machine/reg.h>
 
+#include <ufs/ufs/quota.h>
+#include <ufs/ufs/inode.h>
+#include <ufs/ufs/ufs_extern.h>
+
 static long *exec_copyout_strings __P((struct image_params *));
 
 static long ps_strings = PS_STRINGS;
@@ -165,6 +169,15 @@
 	VOP_UNLOCK(imgp->vp, 0, p);
 	if (error)
 		goto exec_fail_dealloc;
+
+	/*
+	 * At this point, it counts as an access, whether it succeeds or
+	 * fails.  Ensure that atime gets updated if needed
+	 */
+	if ((imgp->vp->v_mount->mnt_flag & MNT_NOATIME) == 0) {
+		VTOI(imgp->vp)->i_flag |= IN_ACCESS;
+		ufs_itimes(imgp->vp);
+	}
 
 	/*
 	 * Loop through list of image activators, calling each one.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E14ct8C-0000B5-00>