From: Ian Bridges <icb@fastmail.org>
To: koray.fra@gmail.com
Cc: linkinjeon@kernel.org, pc@manguebit.org,
senozhatsky@chromium.org, tom@talpey.com,
chenxiaosong@chenxiaosong.com, hyc.lee@gmail.com,
ronniesahlberg@gmail.com, sprasad@microsoft.com,
bharathsm@microsoft.com, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Ian Bridges <icb@fastmail.org>
Subject: Re: [PATCH 1/2] ksmbd: fix negative timestamps being saved to disk
Date: Thu, 12 Nov 2026 12:27:37 -0600 [thread overview]
Message-ID: <20261112182737.1659245-1-icb@fastmail.org> (raw)
In-Reply-To: <20261112111637.184045-1-koray.fra@gmail.com>
Hi,
On Thu, Nov 12, 2026 at 12:16:36PM +0100, koraynilay wrote:
> When setting a timestamp before epoch 0, ksmbd converts it from NT
> format to Unix format without normalizing it, leading to the nanoseconds
> field to be saved (on-disk too) as a negative number, which leads to a
> garbled stat command output and a reported +4 seconds in the timestamp.
I tested this with the ksmbd code from ksmbd-for-next. Before the
patch, setting an access or write time before 1970 with a fraction of
a second stored the wrong time on disk. The stored time was about four
seconds late, stat showed garbage for the fraction, and a query over
SMB returned the wrong time too. With the patch, the time on disk and
the time returned over SMB match the time that was set. Times after
1970, and whole seconds before it, behave as before. smbtorture gives
the same results as without the patch, and KASAN reports nothing.
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
prev parent reply other threads:[~2026-11-12 18:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 11:16 koraynilay
2026-11-12 11:16 ` [PATCH 2/2] cifs: fix negative timestamps being read from smb koraynilay
2026-11-12 18:27 ` Ian Bridges [this message]
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=20261112182737.1659245-1-icb@fastmail.org \
--to=icb@fastmail.org \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@chenxiaosong.com \
--cc=hyc.lee@gmail.com \
--cc=koray.fra@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=senozhatsky@chromium.org \
--cc=sprasad@microsoft.com \
--cc=stable@vger.kernel.org \
--cc=tom@talpey.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®