linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 23732] New: ext4 timestamp range contains 68-year gaps
@ 2010-11-25 11:28 bugzilla-daemon
  2012-08-14 13:40 ` [Bug 23732] " bugzilla-daemon
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: bugzilla-daemon @ 2010-11-25 11:28 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

           Summary: ext4 timestamp range contains 68-year gaps
           Product: File System
           Version: 2.5
    Kernel Version: 2.6.35
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: ext4
        AssignedTo: fs_ext4@kernel-bugs.osdl.org
        ReportedBy: mh8928@yahoo.com
        Regression: No


When 256-byte inodes are used, ext4 attempts to extend the tv_sec
portion of file timestamps from 32 to 34 bits on 64-bit systems,
presumably to defer the Y2038 problem.  However the code to do
this still fails in 2038.  Nevertheless, some timestamps beyond
the year 2038 work correctly.

Using 2.6.35/x86_64 on ext4 with 256-byte inodes:

markh@zacc:~$ touch -d 2038-01-31 /test/2038
markh@zacc:~$ touch -d 2106-02-22 /test/2106
markh@zacc:~$ ls -l /test/2038 /test/2106
-rw-r--r-- 1 markh markh 0 2038-01-31 00:00 /test/2038
-rw-r--r-- 1 markh markh 0 2106-02-22 00:00 /test/2106
markh@zacc:~$ sudo umount /test
markh@zacc:~$ sudo mount /dev/sda2 /test
markh@zacc:~$ ls -l /test/2038 /test/2106
-rw-r--r-- 1 markh markh 0 1901-12-25 17:31 /test/2038
-rw-r--r-- 1 markh markh 0 2106-02-22 00:00 /test/2106
markh@zacc:~$ 

The problem is in fs/ext4/ext.h.  The macros EXT4_INODE_GET_XTIME
and EXT4_EINODE_GET_XTIME sign-extend the low 32 bits of tv_sec,
and then ext4_decode_extra_time uses "|=" to tack on the 2
additional bits.  However if bit 31 is 1, bits 32..63 will always
be 1 due to the sign extension regardless of the 2 extra bits:

static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
{
       if (sizeof(time->tv_sec) > 4)
           time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
                   << 32;
       time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >>
EXT4_EPOCH_BITS;
}

...

#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode)                   \
do {                                           \
    (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime);       \
    if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra))     \
        ext4_decode_extra_time(&(inode)->xtime,                   \
                       raw_inode->xtime ## _extra);           \
} while (0)


It is not clear what time range was intended to be handled,
but the range should be continuous.  Preferably it would be the
range -0x80000000 (1901-12-13) to 0x37fffffff (2446-05-10),
in order to handle all legacy 32-bit timestamps and as many
consecutive future dates as possible.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
@ 2012-08-14 13:40 ` bugzilla-daemon
  2014-03-30 13:47 ` bugzilla-daemon
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2012-08-14 13:40 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732


Alan <alan@lxorguk.ukuu.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alan@lxorguk.ukuu.org.uk
     Kernel Version|2.6.35                      |3.6-rc1




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
  2012-08-14 13:40 ` [Bug 23732] " bugzilla-daemon
@ 2014-03-30 13:47 ` bugzilla-daemon
  2014-03-30 15:08 ` bugzilla-daemon
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2014-03-30 13:47 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

Conrad Meyer <cse.cem@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cse.cem@gmail.com

--- Comment #1 from Conrad Meyer <cse.cem@gmail.com> ---
Impressively, this bug is still present in v3.14-rc8.

$ touch -d 2038-01-31 test-123
$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
$ ls -ld test-123
drwxrwxr-x 2 cmeyer cmeyer 4096 Dec 25  1901 test-123

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
  2012-08-14 13:40 ` [Bug 23732] " bugzilla-daemon
  2014-03-30 13:47 ` bugzilla-daemon
@ 2014-03-30 15:08 ` bugzilla-daemon
  2014-03-30 15:18 ` bugzilla-daemon
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2014-03-30 15:08 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #2 from Conrad Meyer <cse.cem@gmail.com> ---
Patch submitted, seems to fix the issue on my system.

https://lkml.org/lkml/2014/3/30/40

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (2 preceding siblings ...)
  2014-03-30 15:08 ` bugzilla-daemon
@ 2014-03-30 15:18 ` bugzilla-daemon
  2014-03-30 15:19 ` bugzilla-daemon
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2014-03-30 15:18 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #3 from Conrad Meyer <cse.cem@gmail.com> ---
34 (signed) bits of seconds gets us to Y2242:

$ touch -d 2242-01-01 test-123
$ sync ;sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"; sleep 1; sudo sh -c
"echo 3 > /proc/sys/vm/drop_caches"; sleep 1; ls -ld test-123
drwxrwxr-x 2 cmeyer cmeyer 4096 Jan  1  2242 test-123
$ touch -d 2243-01-01 test-123
$ sync ;sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"; sleep 1; sudo sh -c
"echo 3 > /proc/sys/vm/drop_caches"; sleep 1; ls -ld test-123
drwxrwxr-x 2 cmeyer cmeyer 4096 Aug  3  1698 test-123

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (3 preceding siblings ...)
  2014-03-30 15:18 ` bugzilla-daemon
@ 2014-03-30 15:19 ` bugzilla-daemon
  2014-04-01  3:32 ` bugzilla-daemon
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2014-03-30 15:19 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #4 from Conrad Meyer <cse.cem@gmail.com> ---
(Which we expect, given:)

$ echo $((1970+(2038-1970)*4))
2242

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (4 preceding siblings ...)
  2014-03-30 15:19 ` bugzilla-daemon
@ 2014-04-01  3:32 ` bugzilla-daemon
  2015-02-19 16:01 ` bugzilla-daemon
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2014-04-01  3:32 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #5 from Conrad Meyer <cse.cem@gmail.com> ---
Hm, ignore my patch I guess. Some historical context:

http://thread.gmane.org/gmane.comp.file-systems.ext4/40978

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (5 preceding siblings ...)
  2014-04-01  3:32 ` bugzilla-daemon
@ 2015-02-19 16:01 ` bugzilla-daemon
  2015-02-20 20:01   ` Andreas Dilger
  2015-02-19 16:15 ` bugzilla-daemon
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-19 16:01 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

Alan <alan@lxorguk.ukuu.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |CODE_FIX

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (6 preceding siblings ...)
  2015-02-19 16:01 ` bugzilla-daemon
@ 2015-02-19 16:15 ` bugzilla-daemon
  2015-02-19 19:22 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-19 16:15 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #6 from Conrad Meyer <cse.cem@gmail.com> ---
> RESOLVED CODE_FIX

Alan, what patch fixed it (sha1)? Thanks!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (7 preceding siblings ...)
  2015-02-19 16:15 ` bugzilla-daemon
@ 2015-02-19 19:22 ` bugzilla-daemon
  2015-02-19 20:16 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-19 19:22 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #7 from Alan <alan@lxorguk.ukuu.org.uk> ---
I don't have the number. I re-ran your test case

[root@localhost next]# touch -d 2038-01-31 test-123
[root@localhost next]# ls -l test-123
-rw-r--r--. 1 root root 0 Jan 31  2038 test-123
[root@localhost next]# echo 3 >/proc/sys/vm/drop_caches 
[root@localhost next]# ls -l test-123
-rw-r--r--. 1 root root 0 Jan 31  2038 test-123

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (8 preceding siblings ...)
  2015-02-19 19:22 ` bugzilla-daemon
@ 2015-02-19 20:16 ` bugzilla-daemon
  2015-02-19 20:18 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-19 20:16 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #8 from Conrad Meyer <cse.cem@gmail.com> ---
The test case is 'touch -d 2243-01-01 test-123'... 2038 works fine.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (9 preceding siblings ...)
  2015-02-19 20:16 ` bugzilla-daemon
@ 2015-02-19 20:18 ` bugzilla-daemon
  2015-02-21  1:15 ` bugzilla-daemon
  2016-03-20 16:54 ` bugzilla-daemon
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-19 20:18 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

--- Comment #9 from Conrad Meyer <cse.cem@gmail.com> ---
Hm, 2243 appears to work now too. *Shrug*.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Bug 23732] ext4 timestamp range contains 68-year gaps
  2015-02-19 16:01 ` bugzilla-daemon
@ 2015-02-20 20:01   ` Andreas Dilger
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Dilger @ 2015-02-20 20:01 UTC (permalink / raw)
  To: Ext4 Developers List

On Feb 19, 2015, at 9:01 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=23732
> 
> Alan <alan@lxorguk.ukuu.org.uk> changed:
> 
>           What    |Removed                     |Added
> --------------------------------------------------------------------
>             Status|NEW                         |RESOLVED
>         Resolution|---                         |CODE_FIX

I see Alan closed this bug, but I don't see what was done to actually
fix it?  The patches from last year about this time didn't land AFAICS:

  [PATCH v8 1/2] ext4: Fix handling of extended tv_sec (bug 23732)
  [PATCH v8 2/2] e2fsck: Correct ext4 dates generated by old kernels

or did this get fixed in some other way?

Cheers, Andreas






^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (10 preceding siblings ...)
  2015-02-19 20:18 ` bugzilla-daemon
@ 2015-02-21  1:15 ` bugzilla-daemon
  2016-03-20 16:54 ` bugzilla-daemon
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2015-02-21  1:15 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

Theodore Tso <tytso@mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |tytso@mit.edu
         Resolution|CODE_FIX                    |---

--- Comment #10 from Theodore Tso <tytso@mit.edu> ---
I'm not sure why the test cases have been passing but the true fix hasn't been
applied yet.  This is due to my not having time and the need for us to have
better test cases in e2fsprogs (for both the old and new encodings, etc.)   As
usual, the highly urgent problems with short-term deadlines tend to get higher
priority from the important long-term items.

Specifically, I want to be able to convert time strings to integers using both
the old the new encodings, and then have test cases to make sure that e2fsck
and the kernel are doing the right thing and coverting as necessary as we had
determined in the migration plan for this bug.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug 23732] ext4 timestamp range contains 68-year gaps
  2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
                   ` (11 preceding siblings ...)
  2015-02-21  1:15 ` bugzilla-daemon
@ 2016-03-20 16:54 ` bugzilla-daemon
  12 siblings, 0 replies; 15+ messages in thread
From: bugzilla-daemon @ 2016-03-20 16:54 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=23732

Theodore Tso <tytso@mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |CODE_FIX

--- Comment #11 from Theodore Tso <tytso@mit.edu> ---
This has been fixed in the latest kernel and e2fsprogs

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-03-20 16:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 11:28 [Bug 23732] New: ext4 timestamp range contains 68-year gaps bugzilla-daemon
2012-08-14 13:40 ` [Bug 23732] " bugzilla-daemon
2014-03-30 13:47 ` bugzilla-daemon
2014-03-30 15:08 ` bugzilla-daemon
2014-03-30 15:18 ` bugzilla-daemon
2014-03-30 15:19 ` bugzilla-daemon
2014-04-01  3:32 ` bugzilla-daemon
2015-02-19 16:01 ` bugzilla-daemon
2015-02-20 20:01   ` Andreas Dilger
2015-02-19 16:15 ` bugzilla-daemon
2015-02-19 19:22 ` bugzilla-daemon
2015-02-19 20:16 ` bugzilla-daemon
2015-02-19 20:18 ` bugzilla-daemon
2015-02-21  1:15 ` bugzilla-daemon
2016-03-20 16:54 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).