<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/fs/ext4, branch stable/3.4.y</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F3.4.y</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=stable%2F3.4.y'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2016-10-26T15:15:34Z</updated>
<entry>
<title>ext4: Fix handling of extended tv_sec</title>
<updated>2016-10-26T15:15:34Z</updated>
<author>
<name>David Turner</name>
<email>novalis@novalis.org</email>
</author>
<published>2015-11-24T19:34:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0a36982a2abdaf4b20401bc0a0ba3881c7071f4a'/>
<id>urn:sha1:0a36982a2abdaf4b20401bc0a0ba3881c7071f4a</id>
<content type='text'>
commit a4dad1ae24f850410c4e60f22823cba1289b8d52 upstream.

In ext4, the bottom two bits of {a,c,m}time_extra are used to extend
the {a,c,m}time fields, deferring the year 2038 problem to the year
2446.

When decoding these extended fields, for times whose bottom 32 bits
would represent a negative number, sign extension causes the 64-bit
extended timestamp to be negative as well, which is not what's
intended.  This patch corrects that issue, so that the only negative
{a,c,m}times are those between 1901 and 1970 (as per 32-bit signed
timestamps).

Some older kernels might have written pre-1970 dates with 1,1 in the
extra bits.  This patch treats those incorrectly-encoded dates as
pre-1970, instead of post-2311, until kernel 4.20 is released.
Hopefully by then e2fsck will have fixed up the bad data.

Also add a comment explaining the encoding of ext4's extra {a,c,m}time
bits.

Signed-off-by: David Turner &lt;novalis@novalis.org&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reported-by: Mark Harris &lt;mh8928@yahoo.com&gt;
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=23732
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4, jbd2: ensure entering into panic after recording an error in superblock</title>
<updated>2016-10-26T15:15:25Z</updated>
<author>
<name>Daeho Jeong</name>
<email>daeho.jeong@samsung.com</email>
</author>
<published>2015-10-18T21:02:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8fb4b054c92925545e6e12b59f0c8b6b6f514984'/>
<id>urn:sha1:8fb4b054c92925545e6e12b59f0c8b6b6f514984</id>
<content type='text'>
commit 4327ba52afd03fc4b5afa0ee1d774c9c5b0e85c5 upstream.

If a EXT4 filesystem utilizes JBD2 journaling and an error occurs, the
journaling will be aborted first and the error number will be recorded
into JBD2 superblock and, finally, the system will enter into the
panic state in "errors=panic" option.  But, in the rare case, this
sequence is little twisted like the below figure and it will happen
that the system enters into panic state, which means the system reset
in mobile environment, before completion of recording an error in the
journal superblock. In this case, e2fsck cannot recognize that the
filesystem failure occurred in the previous run and the corruption
wouldn't be fixed.

Task A                        Task B
ext4_handle_error()
-&gt; jbd2_journal_abort()
  -&gt; __journal_abort_soft()
    -&gt; __jbd2_journal_abort_hard()
    | -&gt; journal-&gt;j_flags |= JBD2_ABORT;
    |
    |                         __ext4_abort()
    |                         -&gt; jbd2_journal_abort()
    |                         | -&gt; __journal_abort_soft()
    |                         |   -&gt; if (journal-&gt;j_flags &amp; JBD2_ABORT)
    |                         |           return;
    |                         -&gt; panic()
    |
    -&gt; jbd2_journal_update_sb_errno()

Tested-by: Hobin Woo &lt;hobin.woo@samsung.com&gt;
Signed-off-by: Daeho Jeong &lt;daeho.jeong@samsung.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>fs: create and use seq_show_option for escaping</title>
<updated>2016-04-27T10:55:18Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2015-09-04T22:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b0cce01be5f58ed399fdfc8e1b0fbcd827a35aef'/>
<id>urn:sha1:b0cce01be5f58ed399fdfc8e1b0fbcd827a35aef</id>
<content type='text'>
commit a068acf2ee77693e0bf39d6e07139ba704f461c3 upstream.

Many file systems that implement the show_options hook fail to correctly
escape their output which could lead to unescaped characters (e.g.  new
lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files.  This
could lead to confusion, spoofed entries (resulting in things like
systemd issuing false d-bus "mount" notifications), and who knows what
else.  This looks like it would only be the root user stepping on
themselves, but it's possible weird things could happen in containers or
in other situations with delegated mount privileges.

Here's an example using overlay with setuid fusermount trusting the
contents of /proc/mounts (via the /etc/mtab symlink).  Imagine the use
of "sudo" is something more sneaky:

  $ BASE="ovl"
  $ MNT="$BASE/mnt"
  $ LOW="$BASE/lower"
  $ UP="$BASE/upper"
  $ WORK="$BASE/work/ 0 0
  none /proc fuse.pwn user_id=1000"
  $ mkdir -p "$LOW" "$UP" "$WORK"
  $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none /mnt
  $ cat /proc/mounts
  none /root/ovl/mnt overlay rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
  none /proc fuse.pwn user_id=1000 0 0
  $ fusermount -u /proc
  $ cat /proc/mounts
  cat: /proc/mounts: No such file or directory

This fixes the problem by adding new seq_show_option and
seq_show_option_n helpers, and updating the vulnerable show_option
handlers to use them as needed.  Some, like SELinux, need to be open
coded due to unusual existing escape mechanisms.

[akpm@linux-foundation.org: add lost chunk, per Kees]
[keescook@chromium.org: seq_show_option should be using const parameters]
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Acked-by: Jan Kara &lt;jack@suse.com&gt;
Acked-by: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: J. R. Okajima &lt;hooanon05g@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[lizf: Backported to 3.4:
 - adjust context
 - one more place in ceph needs to be changed
 - drop changes to overlayfs
 - drop showing vers in cifs]
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: replace open coded nofail allocation in ext4_free_blocks()</title>
<updated>2016-03-21T01:17:40Z</updated>
<author>
<name>Michal Hocko</name>
<email>mhocko@suse.cz</email>
</author>
<published>2015-07-05T16:33:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cfba310a0369d8d5e9b7c3718c749836021ee4e2'/>
<id>urn:sha1:cfba310a0369d8d5e9b7c3718c749836021ee4e2</id>
<content type='text'>
commit 7444a072c387a93ebee7066e8aee776954ab0e41 upstream.

ext4_free_blocks is looping around the allocation request and mimics
__GFP_NOFAIL behavior without any allocation fallback strategy. Let's
remove the open coded loop and replace it with __GFP_NOFAIL. Without the
flag the allocator has no way to find out never-fail requirement and
cannot help in any way.

Signed-off-by: Michal Hocko &lt;mhocko@suse.cz&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp</title>
<updated>2016-03-21T01:17:40Z</updated>
<author>
<name>Nikolay Borisov</name>
<email>kernel@kyup.com</email>
</author>
<published>2015-07-02T05:34:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1ceff7efd3cb0c854ad38b335bf1cf49e25e901a'/>
<id>urn:sha1:1ceff7efd3cb0c854ad38b335bf1cf49e25e901a</id>
<content type='text'>
commit c45653c341f5c8a0ce19c8f0ad4678640849cb86 upstream.

Switch ext4 to using sb_getblk_gfp with GFP_NOFS added to fix possible
deadlocks in the page writeback path.

Signed-off-by: Nikolay Borisov &lt;kernel@kyup.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: don't retry file block mapping on bigalloc fs with non-extent file</title>
<updated>2015-10-22T01:20:05Z</updated>
<author>
<name>Darrick J. Wong</name>
<email>darrick.wong@oracle.com</email>
</author>
<published>2015-06-22T01:10:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2ba0674bed6f8b830c9653015f431794d9c8efda'/>
<id>urn:sha1:2ba0674bed6f8b830c9653015f431794d9c8efda</id>
<content type='text'>
commit 292db1bc6c105d86111e858859456bcb11f90f91 upstream.

ext4 isn't willing to map clusters to a non-extent file.  Don't signal
this with an out of space error, since the FS will retry the
allocation (which didn't fail) forever.  Instead, return EUCLEAN so
that the operation will fail immediately all the way back to userspace.

(The fix is either to run e2fsck -E bmap2extent, or to chattr +e the file.)

Signed-off-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: call sync_blockdev() before invalidate_bdev() in put_super()</title>
<updated>2015-10-22T01:20:05Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2015-06-21T02:50:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b80954b45832fbd665c2a8bc545601716942ce78'/>
<id>urn:sha1:b80954b45832fbd665c2a8bc545601716942ce78</id>
<content type='text'>
commit 89d96a6f8e6491f24fc8f99fd6ae66820e85c6c1 upstream.

Normally all of the buffers will have been forced out to disk before
we call invalidate_bdev(), but there will be some cases, where a file
system operation was aborted due to an ext4_error(), where there may
still be some dirty buffers in the buffer cache for the device.  So
try to force them out to memory before calling invalidate_bdev().

This fixes a warning triggered by generic/081:

WARNING: CPU: 1 PID: 3473 at /usr/projects/linux/ext4/fs/block_dev.c:56 __blkdev_put+0xb5/0x16f()

Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: fix race between truncate and __ext4_journalled_writepage()</title>
<updated>2015-10-22T01:20:04Z</updated>
<author>
<name>Theodore Ts'o</name>
<email>tytso@mit.edu</email>
</author>
<published>2015-06-13T03:45:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c0fd01eee9d08fdedd5a9de4656c32a422844a7'/>
<id>urn:sha1:0c0fd01eee9d08fdedd5a9de4656c32a422844a7</id>
<content type='text'>
commit bdf96838aea6a265f2ae6cbcfb12a778c84a0b8e upstream.

The commit cf108bca465d: "ext4: Invert the locking order of page_lock
and transaction start" caused __ext4_journalled_writepage() to drop
the page lock before the page was written back, as part of changing
the locking order to jbd2_journal_start -&gt; page_lock.  However, this
introduced a potential race if there was a truncate racing with the
data=journalled writeback mode.

Fix this by grabbing the page lock after starting the journal handle,
and then checking to see if page had gotten truncated out from under
us.

This fixes a number of different warnings or BUG_ON's when running
xfstests generic/086 in data=journalled mode, including:

jbd2_journal_dirty_metadata: vdc-8: bad jh for block 115643: transaction (ee3fe7
c0, 164), jh-&gt;b_transaction (  (null), 0), jh-&gt;b_next_transaction (  (null), 0), jlist 0

	      	      	  - and -

kernel BUG at /usr/projects/linux/ext4/fs/jbd2/transaction.c:2200!
    ...
Call Trace:
 [&lt;c02b2ded&gt;] ? __ext4_journalled_invalidatepage+0x117/0x117
 [&lt;c02b2de5&gt;] __ext4_journalled_invalidatepage+0x10f/0x117
 [&lt;c02b2ded&gt;] ? __ext4_journalled_invalidatepage+0x117/0x117
 [&lt;c027d883&gt;] ? lock_buffer+0x36/0x36
 [&lt;c02b2dfa&gt;] ext4_journalled_invalidatepage+0xd/0x22
 [&lt;c0229139&gt;] do_invalidatepage+0x22/0x26
 [&lt;c0229198&gt;] truncate_inode_page+0x5b/0x85
 [&lt;c022934b&gt;] truncate_inode_pages_range+0x156/0x38c
 [&lt;c0229592&gt;] truncate_inode_pages+0x11/0x15
 [&lt;c022962d&gt;] truncate_pagecache+0x55/0x71
 [&lt;c02b913b&gt;] ext4_setattr+0x4a9/0x560
 [&lt;c01ca542&gt;] ? current_kernel_time+0x10/0x44
 [&lt;c026c4d8&gt;] notify_change+0x1c7/0x2be
 [&lt;c0256a00&gt;] do_truncate+0x65/0x85
 [&lt;c0226f31&gt;] ? file_ra_state_init+0x12/0x29

	      	      	  - and -

WARNING: CPU: 1 PID: 1331 at /usr/projects/linux/ext4/fs/jbd2/transaction.c:1396
irty_metadata+0x14a/0x1ae()
    ...
Call Trace:
 [&lt;c01b879f&gt;] ? console_unlock+0x3a1/0x3ce
 [&lt;c082cbb4&gt;] dump_stack+0x48/0x60
 [&lt;c0178b65&gt;] warn_slowpath_common+0x89/0xa0
 [&lt;c02ef2cf&gt;] ? jbd2_journal_dirty_metadata+0x14a/0x1ae
 [&lt;c0178bef&gt;] warn_slowpath_null+0x14/0x18
 [&lt;c02ef2cf&gt;] jbd2_journal_dirty_metadata+0x14a/0x1ae
 [&lt;c02d8615&gt;] __ext4_handle_dirty_metadata+0xd4/0x19d
 [&lt;c02b2f44&gt;] write_end_fn+0x40/0x53
 [&lt;c02b4a16&gt;] ext4_walk_page_buffers+0x4e/0x6a
 [&lt;c02b59e7&gt;] ext4_writepage+0x354/0x3b8
 [&lt;c02b2f04&gt;] ? mpage_release_unused_pages+0xd4/0xd4
 [&lt;c02b1b21&gt;] ? wait_on_buffer+0x2c/0x2c
 [&lt;c02b5a4b&gt;] ? ext4_writepage+0x3b8/0x3b8
 [&lt;c02b5a5b&gt;] __writepage+0x10/0x2e
 [&lt;c0225956&gt;] write_cache_pages+0x22d/0x32c
 [&lt;c02b5a4b&gt;] ? ext4_writepage+0x3b8/0x3b8
 [&lt;c02b6ee8&gt;] ext4_writepages+0x102/0x607
 [&lt;c019adfe&gt;] ? sched_clock_local+0x10/0x10e
 [&lt;c01a8a7c&gt;] ? __lock_is_held+0x2e/0x44
 [&lt;c01a8ad5&gt;] ? lock_is_held+0x43/0x51
 [&lt;c0226dff&gt;] do_writepages+0x1c/0x29
 [&lt;c0276bed&gt;] __writeback_single_inode+0xc3/0x545
 [&lt;c0277c07&gt;] writeback_sb_inodes+0x21f/0x36d
    ...

Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: check for zero length extent explicitly</title>
<updated>2015-09-18T01:20:40Z</updated>
<author>
<name>Eryu Guan</name>
<email>guaneryu@gmail.com</email>
</author>
<published>2015-05-14T23:00:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fc83d2a48ec24c7836bcef1e67af16a84dc3f570'/>
<id>urn:sha1:fc83d2a48ec24c7836bcef1e67af16a84dc3f570</id>
<content type='text'>
commit 2f974865ffdfe7b9f46a9940836c8b167342563d upstream.

The following commit introduced a bug when checking for zero length extent

5946d08 ext4: check for overlapping extents in ext4_valid_extent_entries()

Zero length extent could pass the check if lblock is zero.

Adding the explicit check for zero length back.

Signed-off-by: Eryu Guan &lt;guaneryu@gmail.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
<entry>
<title>ext4: move check under lock scope to close a race.</title>
<updated>2015-09-18T01:20:35Z</updated>
<author>
<name>Davide Italiano</name>
<email>dccitaliano@gmail.com</email>
</author>
<published>2015-05-03T03:21:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c797892cfa290d60a425d863962d285801fee8b'/>
<id>urn:sha1:0c797892cfa290d60a425d863962d285801fee8b</id>
<content type='text'>
commit 280227a75b56ab5d35854f3a77ef74a7ad56a203 upstream.

fallocate() checks that the file is extent-based and returns
EOPNOTSUPP in case is not. Other tasks can convert from and to
indirect and extent so it's safe to check only after grabbing
the inode mutex.

Signed-off-by: Davide Italiano &lt;dccitaliano@gmail.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
[lizf: Backported to 3.4:
 - adjust context
 - return -EOPNOTSUPP instead of jumping to the "out" label]
Signed-off-by: Zefan Li &lt;lizefan@huawei.com&gt;
</content>
</entry>
</feed>
