public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Markus Rechberger" <markus.rechberger@amd.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [patch] x86-64 ext2/ext3 datestamp problem
Date: Tue, 06 Feb 2007 22:40:48 +0100	[thread overview]
Message-ID: <45C8F5E0.5030500@amd.com> (raw)
In-Reply-To: <45C8F419.5040103@amd.com>

Signed-off-by: Markus Rechberger <markus.rechberger@amd.com>

Markus Rechberger wrote:
> Hi,
>
> there is an issue with ext2/ext3 date stamps, if someone creates a file
> with a timestamp between 1902 and 1970(epoch 0) it will overflow and
> result in a higher date than 2038.
>
> $ touch --date "1905-01-01" test
> $ ls -lah test
> -rw-r--r-- 1 root root 0 Jan  1  1905 test (this is a cached value here)
> (remount the partition/clear the cache)
> $ ls -lah test
> -rw-r--r-- 1 root root 0 Feb  6  2041 test
>
> 10000101101111001100011001110000 .. -2051226000 (1905)
> 10000101101111001100011001110000 .. 2243741296 (2041)
>
> this was tested against linus git tree
>
> Markus
>
>   
> ------------------------------------------------------------------------
>
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index dd4e14c..9fa1bd6 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -1079,9 +1079,9 @@ void ext2_read_inode (struct inode * inode)
>  	}
>  	inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
>  	inode->i_size = le32_to_cpu(raw_inode->i_size);
> -	inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
> -	inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
> -	inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
> +	inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
> +	inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime);
> +	inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime);
>  	inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;
>  	ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
>  	/* We now have enough fields to check if the inode was active or not.
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index beaf25f..5d171c0 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -2673,9 +2673,9 @@ void ext3_read_inode(struct inode * inode)
>  	}
>  	inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
>  	inode->i_size = le32_to_cpu(raw_inode->i_size);
> -	inode->i_atime.tv_sec = le32_to_cpu(raw_inode->i_atime);
> -	inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->i_ctime);
> -	inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->i_mtime);
> +	inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
> +	inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime);
> +	inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime);
>  	inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_mtime.tv_nsec = 0;
>  
>  	ei->i_state = 0;
>   


-- 
Markus Rechberger
Operating System Research Center
AMD Saxony LLC & Co. KG




  reply	other threads:[~2007-02-06 21:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06 21:33 [patch] x86-64 ext2/ext3 datestamp problem Markus Rechberger
2007-02-06 21:40 ` Markus Rechberger [this message]
2007-02-06 21:49 ` H. Peter Anvin
2007-02-06 21:57   ` Markus Rechberger
2007-02-06 22:00     ` H. Peter Anvin
2007-02-06 22:07       ` Markus Rechberger
2007-02-06 22:06         ` H. Peter Anvin
2007-02-06 22:23           ` Markus Rechberger

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=45C8F5E0.5030500@amd.com \
    --to=markus.rechberger@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    /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