mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: koraynilay <koray.fra@gmail.com>, David Sterba <dsterba@suse.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Chris Mason <mason@kernel.org>, Jan Kara <jack@suse.cz>,
	Yuezhang Mo <yuezhang.mo@sony.com>, Chuck Lever <cel@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Sean Smith <defendthedisabled@gmail.com>,
	Andrey Albershteyn <aalbersh@kernel.org>,
	Pedro Falcato <pfalcato@suse.de>,
	linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, exfat@lists.linux.dev,
	ntfs3@lists.linux.dev, linux-api@vger.kernel.org
Subject: Re: [RFC PATCH v3 3/5] ntfs3: make crtime user-settable using ptime
Date: Mon, 2 Nov 2026 16:38:45 +0100	[thread overview]
Message-ID: <20261102153845.d67wlorqcbe3c2w7@pali> (raw)
In-Reply-To: <CAOQ4uxhQ3uhq6s+4deEJAQV5iy8QZoucojR58_dUNYrnjt_yvA@mail.gmail.com>

On Monday 02 November 2026 16:09:41 Amir Goldstein wrote:
> On Mon, Nov 2, 2026 at 3:24 PM Pali Rohár <pali@kernel.org> wrote:
> >
> > On Sunday 01 November 2026 02:55:49 koraynilay wrote:
> > > @@ -154,6 +158,11 @@ int ntfs_fileattr_set(const struct mnt_idmap *idmap, struct dentry *dentry,
> > >       if (flags & FS_APPEND_FL)
> > >               new_fl |= S_APPEND;
> > >
> > > +     if (fa->fsx_xflags & FS_XFLAG_PTIME) {
> > > +             ni->i_crtime.tv_sec = fa->fsx_ptime.tv_sec;
> > > +             ni->i_crtime.tv_nsec = fa->fsx_ptime.tv_nsec;
> > > +     }
> > > +
> > >       inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND);
> > >
> > >       /* Save nodump flag to return in ntfs_getattr. */
> > > @@ -275,8 +284,9 @@ int ntfs_getattr(const struct mnt_idmap *idmap, const struct path *path,
> > >       if (unlikely(is_bad_ni(ni)))
> > >               return -EINVAL;
> > >
> > > -     stat->result_mask |= STATX_BTIME;
> > > +     stat->result_mask |= (STATX_BTIME | STATX_PTIME);
> > >       stat->btime = ni->i_crtime;
> > > +     stat->ptime = ni->i_crtime;
> >
> > For me this patch looks dangerous. Somehow I would expect that the
> > "btime" will never change for existing inode.
> >
> > But because the ptime is mapped to i_crtime and ptime is settable from
> > userspace, with this patch it is directly possible to change btime.
> >
> >
> >
> > I was thinking more about it... Is not this just misunderstanding of how
> > the security model around the times is working on different systems?
> > Because on NTFS there is stored just one field which says when the file
> > was created. There are not two fields like "time set by user and time
> > set by system".
> >
> > Windows security model allows anybody with WRITE_ATTRIBUTES access to
> > change that create time. Linux security model does not allow to change it.
> >
> > NTFS in this view is just a filesystem like any other (ext4, btrfs, ...).
> > In my opinion if the ext4 or btrfs filesystem is correctly implemented
> > on Windows systems, then Windows security model should handle it in the
> > same way like for NTFS or exFAT. So if something grants WRITE_ATTRIBUTES
> > access, then Windows should allow to change also btime on ext4 or btrfs.
> >
> >
> >
> > On the other hand, I understand the use case to have two creation times.
> > One time which would never be changed and could be used for any kind of
> > atomic / synchronization by userspace application logic (this btime).
> > And another time for human which can be changed at any time to any value
> > which user wants (this ptime).
> >
> > In any case, I would suggest that filesystem driver would not report to
> > userspace unsupported values and would not try to invent other values
> > and lying about them.
> 
> But all those fs with mutable creation time already report it with STATX_BTIME
> so what can we do about this?

Well, what I wanted above to point out is that the "mutability" of
creation time is not feature of filesystem, but in my opinion rather
property of the security model on the running operating system.

Maybe better question is: how ext4 btimes differs from the ntfs btime?
In my opinion there is no much difference, both of them has meaning
"time when was the file created".

> If userspace requests both STATX_BTIME|STATX_PTIME in mask arg,
> those fs could technically return only STATX_PTIME and it should not regress
> existing programs.
> 
> But this is still a bit surprising behavior is it not?
> 
> Thanks,
> Amir.

I'm not sure what to do with it.

If we allow to change btime of ntfs then for consistency we should also
allow to change btime of ext4.

Maybe another idea... define new capability which would allow to change
btime (on any filesystem)? This would at least make the consistency.

  reply	other threads:[~2026-11-02 15:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01  1:55 [RFC PATCH v3 0/5] add provenance time (ptime) koraynilay
2026-11-01  1:55 ` [RFC PATCH v3 1/5] vfs: " koraynilay
2026-11-02 14:00   ` Amir Goldstein
2026-11-01  1:55 ` [RFC PATCH v3 2/5] vfs: add fileattr_has_fsx_mask() koraynilay
2026-11-01  1:55 ` [RFC PATCH v3 3/5] ntfs3: make crtime user-settable using ptime koraynilay
2026-11-02 14:24   ` Pali Rohár
2026-11-02 15:09     ` Amir Goldstein
2026-11-02 15:38       ` Pali Rohár [this message]
2026-11-03  1:19         ` Andreas Dilger
2026-11-03  8:23           ` Amir Goldstein
2026-11-03  9:49             ` Pali Rohár
2026-11-03 11:04               ` koraynilay
2026-11-01  1:55 ` [RFC PATCH v3 4/5] exfat: " koraynilay
2026-11-01  1:55 ` [RFC PATCH v3 5/5] btrfs: add provenance time (ptime) koraynilay
2026-11-02 14:54 ` [RFC PATCH v3 0/5] " Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102153845.d67wlorqcbe3c2w7@pali \
    --to=pali@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=defendthedisabled@gmail.com \
    --cc=djwong@kernel.org \
    --cc=dsterba@suse.com \
    --cc=exfat@lists.linux.dev \
    --cc=jack@suse.cz \
    --cc=koray.fra@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=pfalcato@suse.de \
    --cc=sj1557.seo@samsung.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yuezhang.mo@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®