On Tue, Mar 11, 2025 at 08:02:19PM -0700, Rik Farrow wrote:
As someone interested in security, I liked the concept
of 'inode change
time'. Creation time is certainly a change, so that fits too.
Changing permissions or overwriting of binaries with trojans was a popular
hacking technique in the 90s. Trojan installation scripts would often
contain commands (touch) to replace the inode modify times, but that
changed the inode change times too, making ctime a more reliable indicator
of tampering.
I have fond memories of looking at the Larn (or was it Hack/Nethack?)
sources and seeing that it checked ctime to prevent people from
cheating by saving and restoring the game save file, since ctime
couldn't be set without either changing the system clock or directly
accessing the file system (or kernel memory) and messing with the
on-disk inode directly.
The workaround for that was to change the system clock
to the desired
ctime, modify the binary, then change the system clock back. Fortunately,
setting system clocks back arbitrarily no longer works in systems I've
used. Perhaps someone knows more about this change?
Multics doesn't allow you to set the the clock back, since they use
accurate time as part of their file system correctness semantics. It
messes with Multics' unique_id abstraction, with their file system
depends on heavily.
Setting system clocks arbitrarily *does* work on most Unix/Linux
systems I've used, although it can cause strange results[1], and you
might have to disable the time daemon first. NSA's SELinux can also
prevent you from setting the system clock, so you might have to
disable it if it is active and you want to play with system time.
[1] There are some hueristics that fsck.ext4 uses which can get fooled
if time goes backwards, but they are much more minor compared with
what could happen with Multics.
On Tue, Mar 11, 2025 at 7:49 PM Larry McVoy
<lm(a)mcvoy.com> wrote:
> I had the exact same reaction, I think I saw the time created and liked
> that semantic. When it morphed into inode change time, as a source
> management guy, I'd much rather have create time than changed time
> since I already got access and modified times.
Yeah, that was actually the cause of the thread on the Linux Kernel
mailing list. There are some people who want Linux to have a
"creation time" which works like the Windows time stamp, which can be
arbitrarily set by an unprivileged process. The arguments are the
ones you've made; in addition, some people want to be able to have a
date which survives being copied from one backup file system to
another, so they can know when a photo or video was created without
having to access the in-line metadata.
What Linux currently has a "birth time" field which can't be changed
by a utimes(2)-like system call. The rationale for that is this is
what XFS had implemented back in the SGI days, and xfs had support for
"birth time" with SGI semantics. The argument for that approach is
that it can be a security thing, which is useful for people doing
forensics analysis. I also wonder if this was used in the
construction of NFS file handles (which for other OS's might be done
via the i_version or i_generation fields, although the arguments about
when *those* fields should be incremented are interesting and there
isn't much agreement about that).
From there was someone who argued that Unix had originally had ctime
as "creation time", and that ctime was "useless" (by which, that
person was arguing that it was useless for *him*). I then pointed out
that while there may have been comments going back to V7 days saying
"creation time", even the comment was changed to "change time" by
1972
in the BSD 4.3 sources, and we weren't going to change ctime semantics
that had been settled for over four decades just because someone
wanted Windows compatibility.
If the answer is "We have always been at war with Oceania" that would
be interesting; which is why I wanted to ask what the history behind
the file comment might have been. Was the comment and the Ritchie and
Thompson paper *ever* correct on this point?
Cheers,
- Ted